Module: algeobra3d

Classes

AlgeobraThreeScene
DefLine3
DefMesh
DefNormal3
DefPlane
DefPoint3
DefReflection3
DefSphere
DefSpherical
DefVector3

Members

(inner, constant) TYPE_LINE3

Type specifier for a 3D line type
Source:

(inner, constant) TYPE_MESH

Type specifier for a mesh type
Source:

(inner, constant) TYPE_PLANE

Type specifier for a plane type
Source:

(inner, constant) TYPE_POINT3

Type specifier for a 3D point type
Source:

(inner, constant) TYPE_SPHERE

Type specifier for a sphere type
Source:

(inner, constant) TYPE_SPHERICAL

Type specifier for a spherical coordinate type
Source:

(inner, constant) TYPE_VECTOR3

Type specifier for a 3D vector type
Source:

(inner, constant) styles

Default style definitions of provided objects
Source:

Methods

(inner) createDefaultGeometryHandlers() → {Object}

Create handlers for types described in this module The map is organized as: TYPE_NAME -> handler Current map provides: TYPE_POINT3, TYPE_LINE3, TYPE_SPHERE, TYPE_VECTOR3, TYPE_PLANE,TYPE_MESH
Source:
Returns:
A map of handlers
Type
Object

(inner) disposeThreeObjectTree(obj)

Disposes a three object with its children
Parameters:
Name Type Description
obj THREE.Object3D
Source:

(inner) intersectLine3Plane(line, plane, epsopt) → {Array.<THREE.Vector3>}

Computes the intersection of a line and a plane The line might be open ended either from the first or the second point. The plane can be infinite or delimited by its spanning vectors.
Parameters:
Name Type Attributes Default Description
line Object The line
plane Object The plane
eps Number <optional>
1e-10 The epsilon value for comparisons
Source:
Returns:
The intersections, if any. A line and a plane have at most one
Type
Array.<THREE.Vector3>

(inner) intersectLine3Sphere(line, sphere, epsopt) → {Array.<THREE.Vector3>}

Computes the intersection of a line and a sphere The line might be open ended either from the first or the second point.
Parameters:
Name Type Attributes Default Description
line Object The line
sphere Object The sphere
eps Number <optional>
1e-10 The epsilon value for comparisons
Source:
Returns:
The intersections, if any. A line and a sphere have at most two.
Type
Array.<THREE.Vector3>

(inner) makeLine3(p0, p1, leftOpen, rightOpen) → {Object}

Helper function to create a 3d line-type object
Parameters:
Name Type Description
p0 THREE.Vector3 The first line point
p1 THREE.Vector3 The second line point
leftOpen Boolean Whether the line extends to infinity from the first point
rightOpen Boolean Whether the line extends to infinity from the second point
Source:
Returns:
Type
Object

(inner) makeMesh(points, normalsopt, uvsopt) → {Object}

Helper function to create a mesh-type object Only points are mandatory. If other attributes are given, they must have the same size as the points
Parameters:
Name Type Attributes Description
points Array.<THREE.Vector3> The points
normals Array.<THREE.Vector3> <optional>
The normals
uvs Array.<THREE.Vector2> <optional>
The uvs
Source:
Returns:
Type
Object

(inner) makePlane(origin, u, b, infinite) → {Object}

Helper function to create a plane-type object
Parameters:
Name Type Description
origin THREE.Vector3 The plane origin
u THREE.Vector3 The first spanning vector
b THREE.Vector3 The second spanning vector
infinite Boolean Whether the plane is infinite
Source:
Returns:
Type
Object

(inner) makePoint3(p) → {Object}

Helper function to create a 3d point-type object
Parameters:
Name Type Description
p THREE.Vector3 The point
Source:
Returns:
Type
Object

(inner) makeSphere(r, center) → {Object}

Helper function to create a sphere-type object
Parameters:
Name Type Description
r Number The radius
center THREE.Vector3 The center
Source:
Returns:
Type
Object

(inner) makeSpherical(r, phi, theta) → {Object}

Helper function to create a spherical coordinate-type object
Parameters:
Name Type Description
r Number The radius
phi Number The phi angle
theta Number The theta angle
Source:
Returns:
Type
Object

(inner) makeVector3(v, ref) → {Object}

Helper function to create a 3d vector-type object
Parameters:
Name Type Description
v THREE.Vector3 The vector
ref THREE.Vector3 The point the vector is attached to
Source:
Returns:
Type
Object

(inner) registerAlgeobraIntersectors()

Registers intersectors at the algeobra registry Currently supported intersectors are: TYPE_LINE3: TYPE_SPHERE, TYPE_PLANE TYPE_SPHERE: TYPE_LINE3 TYPE_PLANE: TYPE_LINE3
Source:

(inner) vecsToTypedArray(vecs, paramsopt, arrayTypeopt)

Helper function to convert an array of THREE vectors into a typed linear buffer
Parameters:
Name Type Attributes Description
vecs Array Vector of THREE vectors
params Object <optional>
arrayType Number <optional>
The type of the typed Array
Source:
Returns:
The typed array