|
|
|
@ -51,7 +51,7 @@ bool Sphere::collision(const Box & b) const {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Sphere::collision(const Plane &p) const {
|
|
|
|
|
return true;
|
|
|
|
|
return p.dist(pos) <= radius;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Sphere::inSphere(Punkt3D p) const {
|
|
|
|
@ -263,6 +263,22 @@ bool Plane::collision(const Plane &p) const {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Plane::onPlane(const Punkt3D &p) const {
|
|
|
|
|
return dist(p) == 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Plane::getIntersectionPoint(const Ray &r, Punkt3D *p) const {
|
|
|
|
|
if(r.dir.calcAngle(norm) && !onPlane(r.pos))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
float param = (pos*norm - r.pos*norm) / (r.dir*norm);
|
|
|
|
|
*p = r.get(param);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float Plane::dist(Punkt3D p) const {
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
|
|
|
|