Search Results for

    Show / Hide Table of Contents

    Class CollisionsHelper

    Contains static methods to help in determining intersections, containment, etc.

    Inheritance
    CollisionsHelper
    Assembly: FlaxEngine.dll
    File: Engine/Core/Math/CollisionsHelper.h
    Syntax
    public class CollisionsHelper

    Methods

    BoxContainsBox(const BoundingBox& box1, const BoundingBox& box2)

    Determines whether a BoundingBox contains a BoundingBox.

    Declaration
    public static ContainmentType BoxContainsBox(const BoundingBox& box1, const BoundingBox& box2)
    Parameters
    BoundingBox box1

    The first box to test.

    BoundingBox box2

    The second box to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    BoxContainsPoint(const BoundingBox& box, const Vector3& point)

    Determines whether a BoundingBox contains a point.

    Declaration
    public static ContainmentType BoxContainsPoint(const BoundingBox& box, const Vector3& point)
    Parameters
    BoundingBox box

    The box to test.

    Vector3 point

    The point to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    BoxContainsSphere(const BoundingBox& box, const BoundingSphere& sphere)

    Determines whether a BoundingBox contains a BoundingSphere.

    Declaration
    public static ContainmentType BoxContainsSphere(const BoundingBox& box, const BoundingSphere& sphere)
    Parameters
    BoundingBox box

    The box to test.

    BoundingSphere sphere

    The sphere to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    BoxIntersectsBox(const BoundingBox& box1, const BoundingBox& box2)

    Determines whether there is an intersection between a BoundingBox and a BoundingBox.

    Declaration
    public static bool BoxIntersectsBox(const BoundingBox& box1, const BoundingBox& box2)
    Parameters
    BoundingBox box1

    The first box to test.

    BoundingBox box2

    The second box to test.

    Returns
    bool

    Whether the two objects intersected.

    BoxIntersectsSphere(const BoundingBox& box, const BoundingSphere& sphere)

    Determines whether there is an intersection between a BoundingBox and a BoundingSphere.

    Declaration
    public static bool BoxIntersectsSphere(const BoundingBox& box, const BoundingSphere& sphere)
    Parameters
    BoundingBox box

    The box to test.

    BoundingSphere sphere

    The sphere to test.

    Returns
    bool

    Whether the two objects intersected.

    ClosestPointBoxPoint(const BoundingBox& box, const Vector3& point)

    Determines the closest point between a BoundingBox and a point.

    Declaration
    public static Vector3 ClosestPointBoxPoint(const BoundingBox& box, const Vector3& point)
    Parameters
    BoundingBox box

    The box to test.

    Vector3 point

    The point to test.

    Returns
    Vector3

    The closest point between the two objects.

    ClosestPointBoxPoint(const BoundingBox& box, const Vector3& point, Vector3& result)

    Determines the closest point between a BoundingBox and a point.

    Declaration
    public static void ClosestPointBoxPoint(const BoundingBox& box, const Vector3& point, Vector3& result)
    Parameters
    BoundingBox box

    The box to test.

    Vector3 point

    The point to test.

    Vector3 result

    When the method completes, contains the closest point between the two objects.

    ClosestPointPlanePoint(const Plane& plane, const Vector3& point)

    Determines the closest point between a Plane and a point.

    Declaration
    public static Vector3 ClosestPointPlanePoint(const Plane& plane, const Vector3& point)
    Parameters
    Plane plane

    The plane to test.

    Vector3 point

    The point to test.

    Returns
    Vector3

    The closest point between the two objects.

    ClosestPointPlanePoint(const Plane& plane, const Vector3& point, Vector3& result)

    Determines the closest point between a Plane and a point.

    Declaration
    public static void ClosestPointPlanePoint(const Plane& plane, const Vector3& point, Vector3& result)
    Parameters
    Plane plane

    The plane to test.

    Vector3 point

    The point to test.

    Vector3 result

    When the method completes, contains the closest point between the two objects.

    ClosestPointPointLine(const Float2& point, const Float2& p0, const Float2& p1)

    Determines the closest point between a point and a line.

    Declaration
    public static Float2 ClosestPointPointLine(const Float2& point, const Float2& p0, const Float2& p1)
    Parameters
    Float2 point

    The point to test.

    Float2 p0

    The line first point.

    Float2 p1

    The line second point.

    Returns
    Float2

    The closest point between the two objects.</result>

    ClosestPointPointLine(const Float2& point, const Float2& p0, const Float2& p1, Float2& result)

    Determines the closest point between a point and a line.

    Declaration
    public static void ClosestPointPointLine(const Float2& point, const Float2& p0, const Float2& p1, Float2& result)
    Parameters
    Float2 point

    The point to test.

    Float2 p0

    The line first point.

    Float2 p1

    The line second point.

    Float2 result

    When the method completes, contains the closest point between the two objects.

    ClosestPointPointLine(const Vector3& point, const Vector3& p0, const Vector3& p1)

    Determines the closest point between a point and a line.

    Declaration
    public static Vector3 ClosestPointPointLine(const Vector3& point, const Vector3& p0, const Vector3& p1)
    Parameters
    Vector3 point

    The point to test.

    Vector3 p0

    The line first point.

    Vector3 p1

    The line second point.

    Returns
    Vector3

    The closest point between the two objects.</result>

    ClosestPointPointLine(const Vector3& point, const Vector3& p0, const Vector3& p1, Vector3& result)

    Determines the closest point between a point and a line.

    Declaration
    public static void ClosestPointPointLine(const Vector3& point, const Vector3& p0, const Vector3& p1, Vector3& result)
    Parameters
    Vector3 point

    The point to test.

    Vector3 p0

    The line first point.

    Vector3 p1

    The line second point.

    Vector3 result

    When the method completes, contains the closest point between the two objects.

    ClosestPointPointTriangle(const Vector3& point, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)

    Determines the closest point between a point and a triangle.

    Declaration
    public static Vector3 ClosestPointPointTriangle(const Vector3& point, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
    Parameters
    Vector3 point

    The point to test.

    Vector3 vertex1

    The first vertex to test.

    Vector3 vertex2

    The second vertex to test.

    Vector3 vertex3

    The third vertex to test.

    Returns
    Vector3

    The closest point between the two objects.

    ClosestPointPointTriangle(const Vector3& point, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Vector3& result)

    Determines the closest point between a point and a triangle.

    Declaration
    public static void ClosestPointPointTriangle(const Vector3& point, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Vector3& result)
    Parameters
    Vector3 point

    The point to test.

    Vector3 vertex1

    The first vertex to test.

    Vector3 vertex2

    The second vertex to test.

    Vector3 vertex3

    The third vertex to test.

    Vector3 result

    When the method completes, contains the closest point between the two objects.

    ClosestPointRectanglePoint(const Rectangle& rect, const Float2& point)

    Determines the closest point between a Rectangle and a point.

    Declaration
    public static Float2 ClosestPointRectanglePoint(const Rectangle& rect, const Float2& point)
    Parameters
    Rectangle rect

    The rectangle to test.

    Float2 point

    The point to test.

    Returns
    Float2

    The closest point between the two objects.

    ClosestPointRectanglePoint(const Rectangle& rect, const Float2& point, Float2& result)

    Determines the closest point between a Rectangle and a point.

    Declaration
    public static void ClosestPointRectanglePoint(const Rectangle& rect, const Float2& point, Float2& result)
    Parameters
    Rectangle rect

    The rectangle to test.

    Float2 point

    The point to test.

    Float2 result

    When the method completes, contains the closest point between the two objects.

    ClosestPointSpherePoint(const BoundingSphere& sphere, const Vector3& point)

    Determines the closest point between a BoundingSphere and a point.

    Declaration
    public static Vector3 ClosestPointSpherePoint(const BoundingSphere& sphere, const Vector3& point)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    Vector3 point

    The point to test.

    Returns
    Vector3

    The closest point between the two objects; or, if the point is directly in the center of the sphere, contains Vector3.Zero.</return>

    ClosestPointSpherePoint(const BoundingSphere& sphere, const Vector3& point, Vector3& result)

    Determines the closest point between a BoundingSphere and a point.

    Declaration
    public static void ClosestPointSpherePoint(const BoundingSphere& sphere, const Vector3& point, Vector3& result)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    Vector3 point

    The point to test.

    Vector3 result

    When the method completes, contains the closest point between the two objects; or, if the point is directly in the center of the sphere, contains Vector3.Zero.

    ClosestPointSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)

    Determines the closest point between a BoundingSphere and a BoundingSphere.

    If the two spheres are overlapping, but not directly on top of each other, the closest point is the 'closest' point of intersection. This can also be considered is the deepest point of intersection.

    Declaration
    public static Vector3 ClosestPointSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)
    Parameters
    BoundingSphere sphere1

    The first sphere to test.

    BoundingSphere sphere2

    The second sphere to test.

    Returns
    Vector3

    The closest point between the two objects; or, if the point is directly in the center of the sphere, contains Vector3.Zero.

    ClosestPointSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2, Vector3& result)

    Determines the closest point between a BoundingSphere and a BoundingSphere.

    If the two spheres are overlapping, but not directly on top of each other, the closest point is the 'closest' point of intersection. This can also be considered is the deepest point of intersection.

    Declaration
    public static void ClosestPointSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2, Vector3& result)
    Parameters
    BoundingSphere sphere1

    The first sphere to test.

    BoundingSphere sphere2

    The second sphere to test.

    Vector3 result

    When the method completes, contains the closest point between the two objects; or, if the point is directly in the center of the sphere, contains Vector3.Zero.

    DistanceBoxBox(const BoundingBox& box1, const BoundingBox& box2)

    Determines the distance between a BoundingBox and a BoundingBox.

    Declaration
    public static Real DistanceBoxBox(const BoundingBox& box1, const BoundingBox& box2)
    Parameters
    BoundingBox box1

    The first box to test.

    BoundingBox box2

    The second box to test.

    Returns
    Real

    The distance between the two objects.

    DistanceBoxPoint(const BoundingBox& box, const Vector3& point)

    Determines the distance between a BoundingBox and a point.

    Declaration
    public static Real DistanceBoxPoint(const BoundingBox& box, const Vector3& point)
    Parameters
    BoundingBox box

    The box to test.

    Vector3 point

    The point to test.

    Returns
    Real

    The distance between the two objects.

    DistancePlanePoint(const Plane& plane, const Vector3& point)

    Determines the distance between a Plane and a point.

    Declaration
    public static Real DistancePlanePoint(const Plane& plane, const Vector3& point)
    Parameters
    Plane plane

    The plane to test.

    Vector3 point

    The point to test.

    Returns
    Real

    The distance between the two objects.

    DistanceSpherePoint(const BoundingSphere& sphere, const Vector3& point)

    Determines the distance between a BoundingSphere and a point.

    Declaration
    public static Real DistanceSpherePoint(const BoundingSphere& sphere, const Vector3& point)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    Vector3 point

    The point to test.

    Returns
    Real

    The distance between the two objects.

    DistanceSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)

    Determines the distance between a BoundingSphere and a BoundingSphere.

    Declaration
    public static Real DistanceSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)
    Parameters
    BoundingSphere sphere1

    The first sphere to test.

    BoundingSphere sphere2

    The second sphere to test.

    Returns
    Real

    The distance between the two objects.

    FrustumContainsBox(const BoundingFrustum& frustum, const BoundingBox& box)

    Declaration
    public static ContainmentType FrustumContainsBox(const BoundingFrustum& frustum, const BoundingBox& box)
    Parameters
    BoundingFrustum frustum

    BoundingBox box

    Returns
    ContainmentType

    FrustumIntersectsBox(const BoundingFrustum& frustum, const BoundingBox& box)

    Declaration
    public static bool FrustumIntersectsBox(const BoundingFrustum& frustum, const BoundingBox& box)
    Parameters
    BoundingFrustum frustum

    BoundingBox box

    Returns
    bool

    IsPointInTriangle(const Float2& point, const Float2& a, const Float2& b, const Float2& c)

    Determines whether the given 2D point is inside the specified triangle.

    Declaration
    public static bool IsPointInTriangle(const Float2& point, const Float2& a, const Float2& b, const Float2& c)
    Parameters
    Float2 point

    The point to check.

    Float2 a

    The first vertex of the triangle.

    Float2 b

    The second vertex of the triangle.

    Float2 c

    The third vertex of the triangle.

    Returns
    bool

    true if point is inside the triangle; otherwise, false.

    LineHitsBox(const Vector3& lineStart, const Vector3& lineEnd, const Vector3& boxMin, const Vector3& boxMax)

    Declaration
    public static Vector2 LineHitsBox(const Vector3& lineStart, const Vector3& lineEnd, const Vector3& boxMin, const Vector3& boxMax)
    Parameters
    Vector3 lineStart

    Vector3 lineEnd

    Vector3 boxMin

    Vector3 boxMax

    Returns
    Vector2

    LineIntersectsLine(const Float2& l1p1, const Float2& l1p2, const Float2& l2p1, const Float2& l2p2)

    Determines whether a line intersects with the other line.

    Declaration
    public static bool LineIntersectsLine(const Float2& l1p1, const Float2& l1p2, const Float2& l2p1, const Float2& l2p2)
    Parameters
    Float2 l1p1

    The first line point 0.

    Float2 l1p2

    The first line point 1.

    Float2 l2p1

    The second line point 0.

    Float2 l2p2

    The second line point 1.

    Returns
    bool

    True if line intersects with the other line

    LineIntersectsRect(const Float2& p1, const Float2& p2, const Rectangle& rect)

    Determines whether a line intersects with the rectangle.

    Declaration
    public static bool LineIntersectsRect(const Float2& p1, const Float2& p2, const Rectangle& rect)
    Parameters
    Float2 p1

    The line point 0.

    Float2 p2

    The line point 1.

    Rectangle rect

    The rectangle.

    Returns
    bool

    True if line intersects with the rectangle

    PlaneIntersectsBox(const Plane& plane, const BoundingBox& box)

    Determines whether there is an intersection between a Plane and a BoundingBox.

    Declaration
    public static PlaneIntersectionType PlaneIntersectsBox(const Plane& plane, const BoundingBox& box)
    Parameters
    Plane plane

    The plane to test.

    BoundingBox box

    The box to test.

    Returns
    PlaneIntersectionType

    Whether the two objects intersected.

    PlaneIntersectsPlane(const Plane& plane1, const Plane& plane2)

    Determines whether there is an intersection between a Plane and a Plane.

    Declaration
    public static bool PlaneIntersectsPlane(const Plane& plane1, const Plane& plane2)
    Parameters
    Plane plane1

    The first plane to test.

    Plane plane2

    The second plane to test.

    Returns
    bool

    Whether the two objects intersected.

    PlaneIntersectsPlane(const Plane& plane1, const Plane& plane2, Ray& line)

    Determines whether there is an intersection between a Plane and a Plane.

    Although a ray is set to have an origin, the ray returned by this method is really a line in three dimensions which has no real origin. The ray is considered valid when both the positive direction is used and when the negative direction is used.

    Declaration
    public static bool PlaneIntersectsPlane(const Plane& plane1, const Plane& plane2, Ray& line)
    Parameters
    Plane plane1

    The first plane to test.

    Plane plane2

    The second plane to test.

    Ray line

    When the method completes, contains the line of intersection as a Ray, or a zero ray if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    PlaneIntersectsPoint(const Plane& plane, const Vector3& point)

    Determines whether there is an intersection between a Plane and a point.

    Declaration
    public static PlaneIntersectionType PlaneIntersectsPoint(const Plane& plane, const Vector3& point)
    Parameters
    Plane plane

    The plane to test.

    Vector3 point

    The point to test.

    Returns
    PlaneIntersectionType

    Whether the two objects intersected.

    PlaneIntersectsSphere(const Plane& plane, const BoundingSphere& sphere)

    Determines whether there is an intersection between a Plane and a BoundingSphere.

    Declaration
    public static PlaneIntersectionType PlaneIntersectsSphere(const Plane& plane, const BoundingSphere& sphere)
    Parameters
    Plane plane

    The plane to test.

    BoundingSphere sphere

    The sphere to test.

    Returns
    PlaneIntersectionType

    Whether the two objects intersected.

    PlaneIntersectsTriangle(const Plane& plane, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)

    Determines whether there is an intersection between a Plane and a triangle.

    Declaration
    public static PlaneIntersectionType PlaneIntersectsTriangle(const Plane& plane, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
    Parameters
    Plane plane

    The plane to test.

    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triangle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Returns
    PlaneIntersectionType

    Whether the two objects intersected.

    RayIntersectsBox(const Ray& ray, const BoundingBox& box, Real& distance)

    Determines whether there is an intersection between a Ray and a BoundingBox.

    Declaration
    public static bool RayIntersectsBox(const Ray& ray, const BoundingBox& box, Real& distance)
    Parameters
    Ray ray

    The ray to test.

    BoundingBox box

    The box to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsBox(const Ray& ray, const BoundingBox& box, Real& distance, Vector3& normal)

    Determines whether there is an intersection between a Ray and a BoundingBox.

    Declaration
    public static bool RayIntersectsBox(const Ray& ray, const BoundingBox& box, Real& distance, Vector3& normal)
    Parameters
    Ray ray

    The ray to test.

    BoundingBox box

    The box to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Vector3 normal

    When the method completes, contains the intersection surface normal vector, or Vector3::Up if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsBox(const Ray& ray, const BoundingBox& box, Vector3& point)

    Determines whether there is an intersection between a Ray and a Plane.

    Declaration
    public static bool RayIntersectsBox(const Ray& ray, const BoundingBox& box, Vector3& point)
    Parameters
    Ray ray

    The ray to test.

    BoundingBox box

    The box to test.

    Vector3 point

    When the method completes, contains the point of intersection, or Vector3.Zero if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsPlane(const Ray& ray, const Plane& plane, Real& distance)

    Determines whether there is an intersection between a Ray and a Plane.

    Declaration
    public static bool RayIntersectsPlane(const Ray& ray, const Plane& plane, Real& distance)
    Parameters
    Ray ray

    The ray to test.

    Plane plane

    The plane to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Returns
    bool

    Whether the two objects intersect.

    RayIntersectsPlane(const Ray& ray, const Plane& plane, Vector3& point)

    Determines whether there is an intersection between a Ray and a Plane.

    Declaration
    public static bool RayIntersectsPlane(const Ray& ray, const Plane& plane, Vector3& point)
    Parameters
    Ray ray

    The ray to test.

    Plane plane

    The plane to test

    Vector3 point

    When the method completes, contains the point of intersection, or Vector3.Zero if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsPoint(const Ray& ray, const Vector3& point)

    Determines whether there is an intersection between a Ray and a point.

    Declaration
    public static bool RayIntersectsPoint(const Ray& ray, const Vector3& point)
    Parameters
    Ray ray

    The ray to test.

    Vector3 point

    The point to test.

    Returns
    bool

    Whether the two objects intersect.

    RayIntersectsRay(const Ray& ray1, const Ray& ray2, Vector3& point)

    Determines whether there is an intersection between a Ray and a Ray.

    This method performs a ray vs ray intersection test based on the following formula from Goldman. s = det([o_2 - o_1, d_2, d_1 x d_2]) / ||d_1 x d_2||^2 t = det([o_2 - o_1, d_1, d_1 x d_2]) / ||d_1 x d_2||^2 Where o_1 is the position of the first ray, o_2 is the position of the second ray, d_1 is the normalized direction of the first ray, d_2 is the normalized direction of the second ray, det denotes the determinant of a matrix, x denotes the cross product, [ ] denotes a matrix, and || || denotes the length or magnitude of a vector.

    Declaration
    public static bool RayIntersectsRay(const Ray& ray1, const Ray& ray2, Vector3& point)
    Parameters
    Ray ray1

    The first ray to test.

    Ray ray2

    The second ray to test.

    Vector3 point

    When the method completes, contains the point of intersection, or Vector3.Zero if there was no intersection.

    Returns
    bool

    Whether the two objects intersect.

    RayIntersectsSphere(const Ray& ray, const BoundingSphere& sphere, Real& distance)

    Determines whether there is an intersection between a Ray and a BoundingSphere.

    Declaration
    public static bool RayIntersectsSphere(const Ray& ray, const BoundingSphere& sphere, Real& distance)
    Parameters
    Ray ray

    The ray to test.

    BoundingSphere sphere

    The sphere to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsSphere(const Ray& ray, const BoundingSphere& sphere, Real& distance, Vector3& normal)

    Determines whether there is an intersection between a Ray and a BoundingSphere.

    Declaration
    public static bool RayIntersectsSphere(const Ray& ray, const BoundingSphere& sphere, Real& distance, Vector3& normal)
    Parameters
    Ray ray

    The ray to test.

    BoundingSphere sphere

    The sphere to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Vector3 normal

    When the method completes, contains the intersection surface normal vector, or Vector3::Up if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsSphere(const Ray& ray, const BoundingSphere& sphere, Vector3& point)

    Determines whether there is an intersection between a Ray and a BoundingSphere.

    Declaration
    public static bool RayIntersectsSphere(const Ray& ray, const BoundingSphere& sphere, Vector3& point)
    Parameters
    Ray ray

    The ray to test.

    BoundingSphere sphere

    The sphere to test.

    Vector3 point

    When the method completes, contains the point of intersection, or Vector3.Zero if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsTriangle(const Ray& ray, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Real& distance)

    Determines whether there is an intersection between a Ray and a triangle.

    This method tests if the ray intersects either the front or back of the triangle. If the ray is parallel to the triangle's plane, no intersection is assumed to have happened. If the intersection of the ray and the triangle is behind the origin of the ray, no intersection is assumed to have happened. In both cases of assumptions, this method returns false.

    Declaration
    public static bool RayIntersectsTriangle(const Ray& ray, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Real& distance)
    Parameters
    Ray ray

    The ray to test.

    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triangle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsTriangle(const Ray& ray, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Real& distance, Vector3& normal)

    Determines whether there is an intersection between a Ray and a triangle.

    This method tests if the ray intersects either the front or back of the triangle. If the ray is parallel to the triangle's plane, no intersection is assumed to have happened. If the intersection of the ray and the triangle is behind the origin of the ray, no intersection is assumed to have happened. In both cases of assumptions, this method returns false.

    Declaration
    public static bool RayIntersectsTriangle(const Ray& ray, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Real& distance, Vector3& normal)
    Parameters
    Ray ray

    The ray to test.

    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triangle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Real distance

    When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

    Vector3 normal

    When the method completes, contains the intersection surface normal vector, or Vector3::Up if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    RayIntersectsTriangle(const Ray& ray, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Vector3& point)

    Determines whether there is an intersection between a Ray and a triangle.

    Declaration
    public static bool RayIntersectsTriangle(const Ray& ray, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3, Vector3& point)
    Parameters
    Ray ray

    The ray to test.

    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triangle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Vector3 point

    When the method completes, contains the point of intersection, or Vector3.Zero if there was no intersection.

    Returns
    bool

    Whether the two objects intersected.

    SphereContainsBox(const BoundingSphere& sphere, const BoundingBox& box)

    Determines whether a BoundingSphere contains a BoundingBox.

    Declaration
    public static ContainmentType SphereContainsBox(const BoundingSphere& sphere, const BoundingBox& box)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    BoundingBox box

    The box to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    SphereContainsPoint(const BoundingSphere& sphere, const Vector3& point)

    Determines whether a BoundingSphere contains a point.

    Declaration
    public static ContainmentType SphereContainsPoint(const BoundingSphere& sphere, const Vector3& point)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    Vector3 point

    The point to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    SphereContainsSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)

    Determines whether a BoundingSphere contains a BoundingSphere.

    Declaration
    public static ContainmentType SphereContainsSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)
    Parameters
    BoundingSphere sphere1

    The first sphere to test.

    BoundingSphere sphere2

    The second sphere to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    SphereContainsTriangle(const BoundingSphere& sphere, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)

    Determines whether a BoundingSphere contains a triangle.

    Declaration
    public static ContainmentType SphereContainsTriangle(const BoundingSphere& sphere, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triangle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    SphereIntersectsSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)

    Determines whether there is an intersection between a BoundingSphere and a BoundingSphere.

    Declaration
    public static bool SphereIntersectsSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2)
    Parameters
    BoundingSphere sphere1

    First sphere to test.

    BoundingSphere sphere2

    Second sphere to test.

    Returns
    bool

    Whether the two objects intersected.

    SphereIntersectsTriangle(const BoundingSphere& sphere, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)

    Determines whether there is an intersection between a BoundingSphere and a triangle.

    Declaration
    public static bool SphereIntersectsTriangle(const BoundingSphere& sphere, const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
    Parameters
    BoundingSphere sphere

    The sphere to test.

    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triangle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Returns
    bool

    Whether the two objects intersected.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat