Gorilla.Utils.Geometry
Unit Gorilla.Utils.Geometry.pasRecords
- record TRaycastData
- record TRaycastResult
- record TEdge
- record TAABB
- record TOBB
- record THalfSpace
- record TInterval
- record TLine
- record TPlane
- record TSphere
- record TTriangle
- record TBVHNode
- record TBVHGeometry
- record TModelGeometry
Constants
- const R32_MAX : Double = 3.403e+38;
- const R32_EPSILON : Double = 1e-08;
Mics. types
- type PBVHGeometry = pointer to TBVHGeometry;
- type PTriangle = pointer to TTriangle;
- type PRaycastData = pointer to TRaycastData;
- type PRaycastResult = pointer to TRaycastResult;
- type PEdge = pointer to TEdge;
- type TCornerArray = array [0..7] of TPoint3D;
- type PAABB = pointer to TAABB;
- type POBB = pointer to TOBB;
- type PHalfSpace = pointer to THalfSpace;
- type PInterval = pointer to TInterval;
- type PLine = pointer to TLine;
- type PPlane = pointer to TPlane;
- type PBVHNode = pointer to TBVHNode;
- type PModelGeometry = pointer to TModelGeometry;
Functions / Procedures
- public function ClampVLH ( a : Single; min : Single; max : Single ) : Single ;
- public function CMP ( const X : Single; const Y : Single ) : Boolean ;
- public procedure ComputeBasis ( const a : TPoint3D; var b : TPoint3D; var c : TPoint3D ) ;
- public function AABBToAABB ( const a : TAABB; const b : TAABB ) : Boolean ;
- public function OBBToOBB ( const obb1 : TOBB; const obb2 : TOBB ) : Boolean ;
- public function MeshToAABB ( const AMesh : PBVHGeometry; const AABB : TAABB ) : Boolean ; overload;
- public function MeshToAABB ( const AMesh : PBVHGeometry; const AABB : TAABB; out ANode : PBVHNode ) : Boolean ; overload;
- public function ModelToAABB ( const AModel : PModelGeometry; const AABB : TAABB ) : Boolean ; overload;
- public function ModelToAABB ( const AModel : PModelGeometry; const AABB : TAABB; out ANode : PBVHNode ) : Boolean ; overload;
- public function ModelToOBB ( const AModel : PModelGeometry; const AOBB : TOBB ) : Boolean ; overload;
- public function ModelToOBB ( const AModel : PModelGeometry; const AOBB : TOBB; out ANode : PBVHNode ) : Boolean ; overload;
- public function Combine ( const A : TAABB; const B : TAABB ) : TAABB ;
- public procedure SplitBVHNode ( ANode : PBVHNode; const AModel : PBVHGeometry; ADepth : Integer ) ;
- public procedure FreeBVHNode ( ANode : PBVHNode ) ;
- public procedure AccelerateMeshGeometry ( AMesh : PBVHGeometry ) ;
- public procedure FreeMeshGeometry ( AMesh : PBVHGeometry ) ;
- public function GetInterval ( const ATriangle : TTriangle; const AAxis : TPoint3D ) : TInterval ; overload;
- public function GetInterval ( const AABB : TAABB; const AAxis : TPoint3D ) : TInterval ; overload;
- public function GetInterval ( const OBB : TOBB; const AAxis : TPoint3D ) : TInterval ; overload;
- public function OverlapOnAxis ( const AABB : TAABB; const ATriangle : PTriangle; const AAxis : TPoint3D ) : Boolean ; overload;
- public function OverlapOnAxis ( const OBB : TOBB; const ATriangle : PTriangle; const AAxis : TPoint3D ) : Boolean ; overload;
- public function OverlapOnAxis ( const obb1 : TOBB; const obb2 : TOBB; const AAxis : TPoint3D ) : Boolean ; overload;
- public function OverlapOnAxis ( const t1 : PTriangle; const t2 : PTriangle; const AAxis : TPoint3D ) : Boolean ; overload;
TAABB
Fields
Methods
- public constructor Create ( X : Single; Y : Single; Z : Single ) ; public constructor CreateFromOrigin ( const AOrigin : TPoint3D; const ASize : TPoint3D ) ; public constructor FromMinMax ( AMin : TPoint3D; AMax : TPoint3D ) ; public constructor FromBoundingBox ( ABox : TBoundingBox ) ;
- public function Contains ( const Other : TAABB ) : Boolean ; overload;
- public function Contains ( const Point : TPoint3D ) : Boolean ; overload;
- public function SurfaceArea ( ) : Single ;
- public function Raycast ( const ARay : TRaycastData ) : Single ; overload;
- public function Raycast ( const ARay : TRaycastData; out ARes : TRaycastResult ) : Boolean ; overload;
- public function Combine ( B : TAABB ) : TAABB ;
- public function GetPosition ( ) : TPoint3D ;
- public function GetSize ( ) : TPoint3D ;
- public function GetExtent ( ) : TPoint3D ;
- public procedure GetCorners ( out APoints : TCornerArray ) ;
- public procedure Transform ( const APos : TPoint3D; const ARot : TMat3 ) ;
- public function Inflate ( AFactor : Single ) : TAABB ;
- public procedure GetClosestPointAndDistance ( const APos : TPoint3D; out APt : TPoint3D; out ADistance : Single ) ;
- public procedure GetFarestPointAndDistance ( const APos : TPoint3D; out APt : TPoint3D; out ADistance : Single ) ;
TOBB
Fields
Methods
- public constructor Create ( AWidth : Single; AHeight : Single; ADepth : Single ) ; public constructor Create ( ASize : TPoint3D; APosition : TPoint3D ) ; public constructor Create ( ASize : TPoint3D; APosition : TPoint3D; AOrientation : TMat3 ) ;
- public function GetAxis ( AIndex : Integer ) : PPoint3D ;
- public function Contains ( const APoint : TPoint3D ) : Boolean ;
- public procedure GetCorners ( out AVertices : TArray<System.Math.Vectors.TPoint3D> ) ;
- public function GetEdges ( ) : TEdgeArray ;
- public function GetAABB ( ) : TAABB ;
- public function ToMeshData ( ) : TMeshData ;
- public function ClosestPoint ( const APoint : TPoint3D ) : TPoint3D ;
- public function Raycast ( const ARay : TRaycastData ) : Single ; overload;
- public function Raycast ( const ARay : TRaycastData; AResult : PRaycastResult ) : Single ; overload;
THalfSpace
Fields
Methods
- public constructor Create ( ADummy : Integer ) ; public constructor Create ( const ANormal : TPoint3D; ADistance : Single ) ;
- public procedure _Set ( const A : TPoint3D; const B : TPoint3D; const C : TPoint3D ) ; overload;
- public procedure _Set ( const N : TPoint3D; const P : TPoint3D ) ; overload;
- public function Origin ( ) : TPoint3D ;
- public function GetDistance ( const P : TPoint3D ) : Single ;
- public function Projected ( const P : TPoint3D ) : TPoint3D ;
TLine
Fields
Methods
- public constructor Create ( ADummy : Integer ) ; public constructor Create ( const A : TPoint3D; const B : TPoint3D ) ; public constructor Create ( AEdge : TEdge ) ;
- public function Contains ( const p : TPoint3D ) : Boolean ;
- public function ClosestPoint ( const p : TPoint3D ) : TPoint3D ;
- public function SphereLinetest ( const APos : TPoint3D; const ARadius : Single ) : Boolean ;
- public function AABBLinetest ( const AABB : TAABB ) : Boolean ;
- public function OBBLinetest ( const OBB : TOBB ) : Boolean ; overload;
- public function OBBLinetest ( const OBB : TOBB; AResult : PRaycastResult ) : Boolean ; overload;
- public function TriangleLinetest ( const triangle : PTriangle ) : Boolean ;
- public function Length ( ) : Single ;
- public function LengthSq ( ) : Single ;
- public function GetDirection ( AInverse : Boolean = False ) : TPoint3D ;
TPlane
Fields
Methods
- public constructor CreateEmpty ( ADummy : Integer ) ; public constructor Create ( const ANormal : TPoint3D; const ADistance : Single ) ; public constructor Create ( ANormal : TPoint3D; APoint : TPoint3D ) ; public constructor Create ( const P1 : TPoint3D; const P2 : TPoint3D; const P3 : TPoint3D ) ; public constructor Create ( const AVector : TVector3D ) ;
- public function Contains ( const p : TPoint3D ) : Boolean ;
- public function ClosestPoint ( const p : TPoint3D ) : TPoint3D ;
- public function IntersectsWith ( const AOBB : TOBB ) : Boolean ; overload;
- public function IntersectsWith ( const AAABB : TAABB ) : Boolean ; overload;
- public function IntersectsWith ( const APlane : TPlane ) : Boolean ; overload;
- public function SignedDistance ( const APoint : TPoint3D ) : Single ;
- public function Raycast ( const ray : TRaycastData ) : Single ; overload;
- public function Raycast ( const ray : TRaycastData; AResult : PRaycastResult ) : Boolean ; overload;
TTriangle
Fields
Methods
- public constructor Create ( const ADummy : Integer ) ; public constructor Create ( const APoint1 : TPoint3D; const APoint2 : TPoint3D; const APoint3 : TPoint3D ) ;
- public function Contains ( const p : TPoint3D ) : Boolean ;
- public function ToPlane ( ) : TPlane ;
- public function ToAABB ( ) : TAABB ;
- public function GetLine ( AIndex : Integer; AInverse : Boolean = False ) : TLine ;
- public function ClosestPoint
(
const
p :
TPoint3D
)
: TPoint3D
;
Computes the closest point on a triangle to the source point.
- public function ClosestPoint2
(
const
pSource :
TPoint3D
)
: TPoint3D
;
Computes the closest point on a triangle to the source point. This method is a bit faster than ClosestPoint() because of less method calls.
- public procedure Transform ( const APos : TPoint3D; const ARot : TMat3 ) ; overload;
- public procedure Transform ( const AMat : TMatrix3D ) ; overload;
- public function IntersectsWith ( const AABB : TAABB ) : Boolean ; overload;
- public function IntersectsWith ( const OBB : TOBB ) : Boolean ; overload;
- public function IntersectsWith ( const ATriangle : TTriangle ) : Boolean ; overload;
- public function IntersectsWithRobust ( const ATriangle : TTriangle ) : Boolean ;
- public function SatCrossEdge ( const A : TPoint3D; const B : TPoint3D; const C : TPoint3D; const D : TPoint3D ) : TPoint3D ;
- public function Barycentric ( const p : TPoint3D ) : TPoint3D ;
- public function Center ( ) : TPoint3D ;
- public function Raycast ( const ray : TRaycastData ) : Single ; overload;
- public function Raycast ( const ray : TRaycastData; AResult : PRaycastResult ) : Boolean ; overload;
- public function Raycast ( const OBB : TOBB; var AResult : TArray<Gorilla.Utils.Geometry.TRaycastResult> ) : Boolean ; overload;
- public function Raycast ( const ATriangle : TTriangle; var AResult : TArray<Gorilla.Utils.Geometry.TRaycastResult> ) : Boolean ; overload;
TBVHNode
Fields
- public Geometry :
PBVHGeometry
- public Bounds :
TAABB
- public Children :
:TBVHNode.:1
- public NumTriangles :
Integer
- public Triangles :
:TBVHNode.:2
Methods
- public constructor Create ( AGeometry : PBVHGeometry ) ;
- public function Raycast ( const ARay : TRaycastData; out ARes : TRaycastResult ) : Boolean ;
- public function IntersectsWith ( const A : TAABB ) : Boolean ; overload;
- public function IntersectsWith ( const A : TAABB; out ANode : PBVHNode ) : Boolean ; overload;
TBVHGeometry
Fields
Methods
- public constructor Create ( ADummy : Integer ) ; public constructor Create ( const AVertexSource : TVertexBuffer; const AIndexSource : TIndexBuffer; const ALocal : TMatrix3D ) ;
- private function GetVertex ( AIndex : Integer ) : PPoint3D ;
- private procedure SetVertex ( AIndex : Integer; AValue : PPoint3D ) ;
- private function GetValue ( AIndex : Integer ) : PSingle ;
- private procedure SetValue ( AIndex : Integer; AValue : PSingle ) ;
- public function ToMeshData ( ) : TMeshData ;
- public function Raycast ( const ARay : TRaycastData; out ARes : TRaycastResult ) : Boolean ;
- public function IntersectsWith ( const A : TAABB ) : Boolean ; overload;
- public function IntersectsWith ( const A : TAABB; out ANode : PBVHNode ) : Boolean ; overload;
Properties
TModelGeometry
Fields
- private FContent :
PBVHGeometry
- private FBounds :
TAABB
- public Position :
PPoint3D
- public Rotation :
PMat3
- public Parent :
PModelGeometry
Methods
- public constructor Create ( ADummy : Integer ) ; public constructor Create ( AMesh : PBVHGeometry ) ;
- public function GetMesh ( ) : PBVHGeometry ;
- public function GetBounds ( ) : TAABB ;
- public procedure SetContent ( const AMesh : PBVHGeometry ) ;
- public function GetOBB ( ) : TOBB ;
- public function IntersectsWith ( const A : TAABB ) : Boolean ; overload;
- public function IntersectsWith ( const A : TAABB; out ANode : PBVHNode ) : Boolean ; overload;
- public function IntersectsWith ( const A : TOBB; out ANode : PBVHNode ) : Boolean ; overload;