Example #1
0
bool Plane::Intersects(const Ray &ray, float *d) const
{
    float t;
    bool success = IntersectLinePlane(PointOnPlane(), normal, ray.pos, ray.dir, &t);
    if (d)
        *d = t;
    return success && t >= 0.f;
}
Example #2
0
bool Plane::Intersects(const LineSegment &lineSegment, float *d) const
{
    float t;
    bool success = IntersectLinePlane(PointOnPlane(), normal, lineSegment.a, lineSegment.Dir(), &t);
    const float lineSegmentLength = lineSegment.Length();
    if (d)
        *d = t / lineSegmentLength;
    return success && t >= 0.f && t <= lineSegmentLength;
}
Example #3
0
bool Plane::Intersects(const Line &line, float *d) const
{
    return IntersectLinePlane(PointOnPlane(), normal, line.pos, line.dir, d);
}
Example #4
0
vec Plane::Point(float u, float v) const
{
	vec b1, b2;
	normal.PerpendicularBasis(b1, b2);
	return PointOnPlane() + u * b1 + v * b2;
}
Example #5
0
vec Plane::Point(float u, float v) const
{
	return PointOnPlane() + u * normal.Perpendicular() + v * normal.AnotherPerpendicular();
}