jeExtBox

Last Updated May 4, 2000

Types:

jeExtBox;

typedef struct jeExtBox {
    jeVec3d Min;
    jeVec3d Max;
} jeExtBox;

jeExtBox represents an axially aligned extents box.

Functions:

JETAPI jeBoolean JETCC jeExtBox_Collision(const jeExtBox* B, const jeExtBox* MovingBox, const jeVec3d* Start, const jeVec3d* End, jeFloat* T, jeVec3d* Normal);

This function returns the collision of the stationary extents box B and the extents box MovingBox moving from Start to End, if any.  If there is a collision, T, if non-NULL, is set to the percentage of the path from Start to End at which the collision occured, and Normal, if non-NULL, contains the normal of the normal of box B where the collision occurred.

Returns:  JE_TRUE if a collision occurs, JE_FALSE otherwise.
 

JETAPI jeBoolean JETCC jeExtBox_ContainsPoint(const jeExtBox* B, const jeVec3d * Point);
This function tests whether the point Point is contained by the extents box B.

Returns: JE_TRUE if Point is contained by B, JE_FALSE otherwise.


JETAPI void JETCC jeExtBox_ExtendToEnclose(jeExtBox* B, const jeVec3d* Point );

This function extends the extents box B so as to enclose the point Point.

Returns: nothing.

Notes:
    from EXTBOX.H: Extend a box to encompass the passed point.


JETAPI void JETCC jeExtBox_GetPoint(const jeExtBox* B, const int iPoint, jeVec3d* vPoint);

This function returns the point of extents box B as specified by the integer iPoint in jeVec3d vPoint, if vPoint is non-NULL.  iPoint should contain an integer from 0 to 7 representing one of the 8 corners of the extents box.  Does this need to be in the public API?  Where would this have a use?

Returns: nothing.
 

JETAPI void JETCC jeExtBox_GetScaling(const jeExtBox* B, jeVec3d* pScale);
This function returns the width, height and depth of the extent box B in the vector pScale.

Returns: nothing.


JETAPI void JETCC jeExtBox_GetTranslation(const jeExtBox* B, jeVec3d* pCenter);

This function returns the coordinates of the center of extent box B in the vector pCenter.

Returns: nothing.


JETAPI jeBoolean JETCC jeExtBox_Intersection (const jeExtBox* B1, const jeExtBox* B2, jeExtBox* Result);

This function returns the extent box Result which results from the intersection of the extent boxes B1 and B2.  If there is no intersection then the function returns JE_FALSE and does not alter Result.

Returns: JE_TRUE if B1 and B2 have an intersection, JE_FALSE otherwise.

Notes:
    from EXTBOX.H: Return result of box intersection. If no intersection, returns JE_FALSE and bResult is not modified. If intersection, returns JE_TRUE and fills bResult (if not NULL) with the intersected box, bResult may be one of b1 or b2.


JETAPI jeBoolean JETCC jeExtBox_IsValid(const jeExtBox* B);

This function checks that B is a valid extents box.

Returns: JE_TRUE if B is valid, JE_FALSE otherwise.

Notes:
    from EXTBOX.H: Test a box for validity ( non NULL and max >= min )


JETAPI void JETCC jeExtBox_LinearSweep(const jeExtBox* BoxToSweep, const jeVec3d* StartPoint, const jeVec3d* EndPoint, jeExtBox* EnclosingBox);

This function creates an extents box that encompasses BoxToSweep along the linear path from StartPoint to EndPoint and returns it in EnclosingBox.

Returns: nothing.

Notes:
    from EXTBOX.H: Creates a box that encloses the entire area of a box that moves along linear path


JETAPI jeBoolean JETCC jeExtBox_RayCollision(const jeExtBox* B, const jeVec3d* Start, const jeVec3d* End, jeFloat* T, jeVec3d* Normal);

This function computes the intersection of the ray defined by Start and End with the extents box B, returning the position on the ray of the intersection as a percentage from Start to End in T and the normal of the extents box at the intersection point in Normal.

Returns: JE_TRUE if an interesection exists, JE_FALSE otherwise.

Notes:
    from EXTBOX.H: Collides a ray with box B.  The ray is directed, from Start to End.  Only returns a ray hitting the outside of the box.  On success, JE_TRUE is returned, and if T is non-NULL, T is returned as 0..1 where 0 is a collision at Start, and 1 is a collision at End. If Normal is non-NULL, Normal is the surface normal of the box where the collision occured.


JETAPI void JETCC jeExtBox_Scale(jeExtBox* B, jeFloat DX, jeFloat DY, jeFloat DZ);

This function scales the extents box B about its center by (DX, DY, DZ).

Returns: nothing.


JETAPI void JETCC jeExtBox_Set(jeExtBox* B, jeFloat X1, jeFloat Y1, jeFloat Z1, jeFloat X2, jeFloat Y2, jeFloat Z2);

This function sets the elements of the extents box B.

Returns: nothing.

Notes:
    from EXTBOX.H: Set the values in a box.


JETAPI void JETCC jeExtBox_SetToPoint(jeExtBox* B, const jeVec3d* Point);

This function sets both the Min and Max of the extents box B to Point.

Returns: nothing.

Notes:
    from EXTBOX.H: Set box Min and Max to the passed point.


JETAPI void JETCC jeExtBox_SetScaling(jeExtBox* B, const jeVec3d* pScale);

This function sets the scaling of the extents box B to the vector pScale.  This differs from jeExtBox_Scale in that jeExtBox_Scale is relative to its original scale whereas jeExtBox_SetScaling simply utilizes the center point and sets Min and Max up so that the scaling equals pScale.

Returns: nothing.


JETAPI void JETCC jeExtBox_SetTranslation(jeExtBox* B, const jeVec3d* pCenter );

This function moves the extents box B so that it is centered at pCenter.

Returns: nothing.


JETAPI void JETCC jeExtBox_Translate(jeExtBox* B, jeFloat DX, jeFloat DY, jeFloat DZ );

This function moves the extent box B by (DX,DY,DZ).  This is relative movement in comparison to SetTranslation's absolute.

Returns: nothing.


JETAPI void JETCC jeExtBox_Union(const jeExtBox* B1, const jeExtBox* B2, jeExtBox* Result);

This function computes the union of extent boxes B1 and B2 returning the result in Result.  The union of 2 extent boxes is the extent box that minimally contains both.

Returns: nothing.

Notes:
    from EXTBOX.H: computes union of b1 and b2 and returns in bResult.