Cylinder Class
Constructor
Cylinder
-
radiusTop
-
radiusBottom
-
height
-
numSegments
Parameters:
-
radiusTop
Number -
radiusBottom
Number -
height
Number -
numSegments
NumberThe number of segments to build the cylinder out of
Item Index
Methods
- calculateLocalInertia
- calculateWorldAABB
- clipAgainstHull
- clipFaceAgainstHull
- clipFaceAgainstPlane
- computeEdges
- computeNormals
- computeWorldFaceNormals
- findSeparatingAxis
- getAveragePointLocal
- getFaceNormal
- getPlaneConstantOfFace
- pointIsInside
- testSepAxis
- transformAllPoints
- updateBoundingSphereRadius
- volume
Methods
clipAgainstHull
-
posA
-
quatA
-
hullB
-
posB
-
quatB
-
separatingNormal
-
minDist
-
maxDist
-
result
Parameters:
-
posA
Vec3 -
quatA
Quaternion -
hullB
ConvexPolyhedron -
posB
Vec3 -
quatB
Quaternion -
separatingNormal
Vec3 -
minDist
NumberClamp distance
-
maxDist
Number -
result
ArrayThe an array of contact point objects, see clipFaceAgainstHull
clipFaceAgainstHull
-
separatingNormal
-
posA
-
quatA
-
worldVertsB1
-
minDist
-
maxDist
-
Array
Clip a face against a hull.
Parameters:
-
separatingNormal
Vec3 -
posA
Vec3 -
quatA
Quaternion -
worldVertsB1
ArrayAn array of Vec3 with vertices in the world frame.
-
minDist
NumberDistance clamping
-
maxDist
Number -
Array
Objectresult Array to store resulting contact points in. Will be objects with properties: point, depth, normal. These are represented in world coordinates.
clipFaceAgainstPlane
-
inVertices
-
outVertices
-
planeNormal
-
planeConstant
Clip a face in a hull against the back of a plane.
Parameters:
-
inVertices
Array -
outVertices
Array -
planeNormal
Vec3 -
planeConstant
NumberThe constant in the mathematical plane equation
computeEdges
()
Computes uniqueEdges
computeNormals
()
Compute the normals of the faces. Will reuse existing Vec3 objects in the .faceNormals array if they exist.
computeWorldFaceNormals
-
quat
Updates .worldVertices and sets .worldVerticesNeedsUpdate to false.
Parameters:
-
quat
Quaternion
findSeparatingAxis
-
hullB
-
posA
-
quatA
-
posB
-
quatB
-
target
Find the separating axis between this hull and another
Parameters:
-
hullB
ConvexPolyhedron -
posA
Vec3 -
quatA
Quaternion -
posB
Vec3 -
quatB
Quaternion -
target
Vec3The target vector to save the axis in
Returns:
Returns false if a separation is found, else true
getAveragePointLocal
-
target
Get an average of all the vertices positions
Parameters:
-
target
Vec3
Returns:
getFaceNormal
-
i
-
target
Compute the normal of a face from its vertices
Parameters:
-
i
Number -
target
Vec3
getPlaneConstantOfFace
-
face_i
Parameters:
-
face_i
NumberIndex of the face
Returns:
pointIsInside
-
p
Checks whether p is inside the polyhedra. Must be in local coords. The point lies outside of the convex hull of the other points if and only if the direction of all the vectors from it to those other points are on less than one half of a sphere around it.
Parameters:
-
p
Vec3A point given in local coordinates
Returns:
testSepAxis
-
axis
-
hullB
-
posA
-
quatA
-
posB
-
quatB
Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one.
Parameters:
-
axis
Vec3 -
hullB
ConvexPolyhedron -
posA
Vec3 -
quatA
Quaternion -
posB
Vec3 -
quatB
Quaternion
Returns:
The overlap depth, or FALSE if no penetration.
transformAllPoints
-
offset
-
quat
Transform all local points. Will change the .vertices
Parameters:
-
offset
Vec3 -
quat
Quaternion
updateBoundingSphereRadius
()
volume
()
Number
Get approximate convex volume
Returns:
Properties
boundingSphereRadius
Number
The local bounding sphere radius of this shape.
collisionResponse
Boolean
Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.
faceNormals
Array
Array of Vec3
faces
Array
Array of integer arrays, indicating which vertices each face consists of
id
Number
Identifyer of the Shape.
type
Number
The type of this shape. Must be set to an int > 0 by subclasses.
uniqueAxes
Array
If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.
uniqueEdges
Array
Array of Vec3
vertices
Array
Array of Vec3