Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Unit CastleBoxes
Description
Axis-aligned 3D boxes (TBox3D).
Uses
Overview
Classes, Interfaces, Objects and Records
Functions and Procedures
Types
Constants
Variables
Description
Functions and Procedures
function CalculateBoundingBox( Verts: PVector3Single; VertsCount: Cardinal; VertsStride: Cardinal): TBox3D; overload; |
Calculate bounding box of a set of 3D points. This calculates the smallest possible box enclosing all given points. For VertsCount = 0 this returns EmptyBox3D.
Overloaded version with Transform parameter transforms each point by given matrix.
Overloaded version with GetVertex as a function uses GetVertex to query for indexes from [0 .. VertsCount - 1] range.
As usual, VertsStride = 0 means VertsStride = SizeOf(TVector3Single).
|
function CalculateBoundingBoxFromIndices( GetVertIndex: TGetIndexFromIndexNumFunc; VertsIndicesCount: integer; GetVertex: TGetVertexFromIndexFunc): TBox3D; overload; |
Calculate bounding box of a set of indexed 3D points.
This is much like CalculateBoundingBox, except there are two functions: For each number in [0 .. VertsIndicesCount - 1] range, GetVertIndex returns an index. If this index is >= 0 then it's used to query GetVertex function to get actual vertex position.
Indexes < 0 are ignored, this is sometimes comfortable. E.g. for VRML models, you often have a list of indexes with -1 in between marking end of faces.
Returns smallest box enclosing all vertexes.
Overloaded version with Transform parameter transforms each point by given matrix.
|
function IsCenteredBox3DPlaneCollision( const BoxHalfSize: TVector3Single; const Plane: TVector4Single): boolean; overload; |
Tests for collision between box3d centered around (0, 0, 0) and a plane.
Note that you can't express empty box3d here: all BoxHalfSize items must be >= 0. The case when size = 0 is considered like infintely small box in some dimension (e.g. if all three sizes are = 0 then the box becomes a point).
|
function BoundingBox3DFromSphere(const Center: TVector3Single; const Radius: Single): TBox3D; |
Smallest possible box enclosing a sphere with Center, Radius.
|
Types
TGetIndexFromIndexNumFunc = function (indexNum: integer): integer of object; |
|
TPlaneCollision = (...); |
State of collision between a plane and some other object.
pcNone occurs only when the "other object" is empty (TBox3D.IsEmpty, in case of box). Other values mean that the other object is not empty.
pcOutside means that the whole object is on the side of the plane pointed by plane direction (normal) vector. More formally, every point P inserted into the plane equation will yield (P*PlaneNormal + PlaneD) > 0.
pcInside is the reverse of pcOutside: the other object is on the side of plane pointed by inverted plane normal. Every point inserted into plane equation will yield < 0.
pcIntersecting is, well, the remaining case. It means that there's for sure some point P of other object that, when inserted into plane equation, will yield = 0.
Values
-
pcIntersecting:
-
pcOutside:
-
pcInside:
-
pcNone:
|
Constants
EmptyBox3D: TBox3D = (Data: ((0, 0, 0), (-1, -1, -1))); |
Special TBox3D value meaning "bounding box is empty". This is different than just bounding box with zero sizes, as bounding box with zero sizes still has some position. Empty bounding box doesn't contain any portion of 3D space.
|
Variables
Box3DPlaneCollisionEqualityEpsilon: Double = 1e-5; |
Special equality epsilon used by IsCenteredBox3DPlaneCollision. For implementation reasons, they always use Double precision (even when called with arguments with Single precision), and still have to use epsilon slightly larger than usual CastleVectors.DoubleEqualityEpsilon.
|
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:12
|