Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

104 wiersze
1.5 KiB

#include "geotypes.h"
namespace segl {
Sphere::Sphere(Punkt3D _pos, float _radius) {
pos = _pos;
radius = _radius;
}
Sphere::Sphere() {
radius = 1.0f;
}
bool Sphere::collision(const Sphere &s) {
}
bool Sphere::collision(const Ray &r) {
}
bool Sphere::collision(const Box & b) {
}
bool Sphere::collision(const Plane &p) {
}
Ray::Ray() {
dir.set(0.0f, 1.0f, 0.0f);
}
Ray::Ray(Punkt3D _pos, Punkt3D _dir) {
pos = _pos;
dir = _dir;
}
bool Ray::collision(const Sphere &s) {
return s.collision(*this);
}
bool Ray::collision(const Ray &r);
bool Ray::collision(const Box & b);
bool Ray::collision(const Plane &p);
Box::Box() {
max.set(1.0f, 1.0f, 1.0f);
}
Box::Box(Punkt3D _min, Punkt3D _max) {
min = _min;
max = _max;
}
bool Box::collision(const Sphere &s) {
return s.collision(*this);
}
bool Box::collision(const Ray &r) {
return r.collision(*this);
}
bool Box::collision(const Box & b) {
}
bool Box::collision(const Plane &p) {
}
Plane::Plane() {
norm.set(0.0f, 1.0f, 0.0f);
}
Plane::Plane(Punkt3D _pos, Punkt3D _norm) {
pos = _pos;
norm = _norm;
}
Plane::Plane(float x, float y, float z, float a) {
// TODO: Implementation (if not too lazy)
norm.set(x, y, z);
norm.normalize();
}
bool Plane::collision(const Sphere &s) {
return s.collision(*this);
}
bool Plane::collision(const Ray &r) {
return r.collision(*this);
}
bool Plane::collision(const Box & b) {
return b.collision(*this);
}
bool Plane::collision(const Plane &p) {
}
} // namespace segl