Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "rect-circle"

Index

Variables

Const testAABBSphere

testAABBSphere: Fn4<ArrayLikeIterable<number>, ArrayLikeIterable<number>, ArrayLikeIterable<number>, number, boolean> = testBoxSphere.add(3,(boxMinPos, boxSize, spherePos, r) =>axis(spherePos[0], boxMinPos[0], boxSize[0]) +axis(spherePos[1], boxMinPos[1], boxSize[1]) +axis(spherePos[2], boxMinPos[2], boxSize[2]) <=r * r)

Same as testRectCircle, but for 3D AABB and sphere.

param
param
param
param

Const testBoxSphere

testBoxSphere: MultiVecOpImpl<Fn4<ReadonlyVec, ReadonlyVec, ReadonlyVec, number, boolean>> = vop(0)

Const testCenteredAABBSphere

testCenteredAABBSphere: Fn4<ArrayLikeIterable<number>, ArrayLikeIterable<number>, ArrayLikeIterable<number>, number, boolean> = testCenteredBoxSphere.add(3,(boxPos, { 0: w, 1: h, 2: d }, spherePos, r) =>axis(spherePos[0], boxPos[0] - w, w * 2) +axis(spherePos[1], boxPos[1] - h, h * 2) +axis(spherePos[2], boxPos[2] - d, d * 2) <=r * r)

Similar to testAABBSphere, but for AABBs defined by centroid and radius-like extent.

param
param
param
param

Const testCenteredBoxSphere

testCenteredBoxSphere: MultiVecOpImpl<Fn4<ReadonlyVec, ReadonlyVec, ReadonlyVec, number, boolean>> = vop(0)

Like testCenteredAABBSphere, but for arbitrary dimensions w/ optimized execution for 2D & 3D cases.

param
param
param
param

Const testCenteredRectCircle

testCenteredRectCircle: Fn4<ArrayLikeIterable<number>, ArrayLikeIterable<number>, ArrayLikeIterable<number>, number, boolean> = testCenteredBoxSphere.add(2,(boxPos, { 0: w, 1: h }, circlePos, r) =>axis(circlePos[0], boxPos[0] - w, w * 2) +axis(circlePos[1], boxPos[1] - h, h * 2) <=r * r)

Similar to testRectCircle, but for rects defined by centroid and radius-like extent.

param
param
param
param

Const testRectCircle

testRectCircle: Fn4<ArrayLikeIterable<number>, ArrayLikeIterable<number>, ArrayLikeIterable<number>, number, boolean> = testBoxSphere.add(2,(boxMinPos, boxSize, circlePos, r) =>axis(circlePos[0], boxMinPos[0], boxSize[0]) +axis(circlePos[1], boxMinPos[1], boxSize[1]) <=r * r)

Returns true if given 2D rect defined by boxMinPos and boxSize intersects circle.

param
param
param
param

Functions

Const axis

  • axis(a: number, b: number, c: number): number

Generated using TypeDoc