BoundingVolumeHelpers.kl¶
Functions¶
BBoxContains¶
Boolean BBoxContains ( in Vec3 min, in Vec3 max, in Vec3 point )
Returns true if point is in or on the box formed by min and max
bBoxIntersectsBBox¶
Boolean bBoxIntersectsBBox ( in Vec3 min1, in Vec3 max1, in Vec3 min2, in Vec3 max2 )
Returns true if the bounding box formed by min1 and max1 intersects the one formed by min2 and max2
bBoxGetClosestPoint¶
Vec3 bBoxGetClosestPoint ( in Vec3 bBoxMin, in Vec3 bBoxMax, in Vec3 position )
If the point is outside the bounding box, returns the closest point on the bounding box formed by bBoxMin and bBoxMax. Else, the point is returned.
getSquaredDistanceToBBox¶
Scalar getSquaredDistanceToBBox ( in Box3 bBox, in Vec3 position )
Returns the squared distance to the bbox
getDistanceToBBox¶
Scalar getDistanceToBBox ( in Box3 bBox, in Vec3 position )
Returns the squared distance to the bbox
bBoxIntersectsBSphere¶
Boolean bBoxIntersectsBSphere ( in Vec3 bBoxMin, in Vec3 bBoxMax, in Vec3 bSphereCenter, in Scalar bSphereSquaredRadius )
Returns true if the bounding box formed by bBoxMin and bBoxMax intersects the sphere centered at bSphereCenter with a squared radius of bSphereSquaredRadius.
transformedBBoxGetBSphere¶
transformedBBoxGetBSphere ( in Mat44 transform, in Vec3 bBoxMin, in Vec3 bBoxMax, out Vec3 bSphereCenter, out Scalar bSphereSquaredRadius )
Returns an approximate bounding sphere for the bounding box formed by bBoxMin and bBoxMax, and transformed with transform.
symmetricOrthographicFrustum¶
Mat44 symmetricOrthographicFrustum ( in Scalar w, in Scalar h, in Scalar n, in Scalar f )
Builds an orthographic projection matrix, which transforms the box range [-w/2, -h/2, n] .. [w/2, h/2, f] into [-1, -1, -1] .. [1, 1, 1].
w | Width of the view (ranging from -w/2 to w/2) |
h | Height of the view (ranging from -h/2 to h/2) |
n | Near plane distance |
f | Far plane distance |
asymmetricOrthographicFrustum¶
Mat44 asymmetricOrthographicFrustum ( in Scalar lx, in Scalar ly, in Scalar ux, in Scalar uy, in Scalar n, in Scalar f )
Builds an orthographic projection matrix, which transforms the box range [lx, ly, n] .. [ux,uy, f] into [-1, -1, -1] .. [1, 1, 1].
lx | Lower x of the view |
ly | Lower y of the view |
ux | Upper x of the view |
uy | Upper y of the view |
n | Near plane distance |
f | Far plane distance |
bBoxGetBSphereIntersection¶
UInt8 bBoxGetBSphereIntersection ( in Vec3 min, in Vec3 max, in Vec3 sphereCenter, in Scalar sphereRadius )
Returns the intersection result of a sphere with a box. IntersectionOverlap is returned if the sphere is both outside and inside of the bounding box IntersectionIncludesOther is returned if the sphere is completely inside the bounding box IntersectionNone is returned if the sphere is completely outside of the bounding box
bBoxGetBSphereIntersection¶
UInt8 bBoxGetBSphereIntersection ( in Vec3 min, in Vec3 max, in Vec3 sphereCenter, in Scalar sphereRadius )
Returns the intersection result of a sphere with a box. IntersectionOverlap is returned if the sphere is both outside and inside of the bounding box IntersectionIncludesOther is returned if the sphere is completely inside the bounding box IntersectionNone is returned if the sphere is completely outside of the bounding box
getBBoxPoints¶
getBBoxPoints ( in Vec3 min, in Vec3 max, out Vec3 pts[8] )
Returns the 8 corner positions of the bbox
transformedBSphereGetBSphere¶
transformedBSphereGetBSphere ( in Mat44 transform, in Vec3 localCenter, in Scalar localRadius, out Vec3 bSphereCenter, out Scalar bSphereSquaredRadius )
Returns the bounding sphere, in global space, of a transformed bounding sphere
bSphereGetBBoxIntersection¶
UInt8 bSphereGetBBoxIntersection ( in Vec3 sphereCenter, in Scalar sphereRadius, in Vec3 min, in Vec3 max )
Returns the intersection result of a box with a sphere. IntersectionOverlap is returned if the box is both outside and inside of the sphere IntersectionIncludesOther is returned if the box is completely inside the sphere IntersectionNone is returned if the box is completely outside of the sphere
symmetricPerspectiveFrustum¶
Mat44 symmetricPerspectiveFrustum ( in Scalar nearWidth, in Scalar nearHeight, in Scalar near, in Scalar far, in Scalar centerX, in Scalar centerY )
Builds a symmetric perspective projection matrix
nearWidth | Width at the near plane of the truncated pyramid |
nearHeight | Height at the near plane of the truncated pyramid |
near | Near plane distance |
far | Far plane distance |
centerX | Translation in X to be applied after the projection |
centerY | Translation in Y to be applied after the projection |