require.mx('mxjs/base/xplot3D.js');
This library provides functions to assist in rendering 3D shapes in mXrap.
Status | Name |
---|---|
Shape Create.arrow
(
Object config,
Shape shape
)
Creates an arrow. Vertices are shared between sides.
|
|
Shape Create.circle
(
Object config,
Shape shape
)
Creates a circle. The configuration available are:
|
|
Shape Create.cone
(
Object config,
Shape shape
)
Creates an cone.
|
|
Shape Create.cuboid
(
Object config,
Shape shape
)
Creates a cuboid. Unlike a true cuboid, this function allows you to specify all 8 points, so you could essentially have a irregular 6 sided 3D polygon.
|
|
Shape Create.cylinder
(
Object config,
Shape shape
)
Creates an cylinder.
|
|
Shape Create.disc
(
Object config,
Shape shape
)
Creates a disc. A Disc is essentially a "hollow" cylinder, being rendered from two (one inner, one outer) cylinders.
|
|
Shape Create.ellipsoid
(
Object config,
Shape shape
)
Creates an ellipsoid using UV mapping. An ellipsoid is a sphere with different radii along three axes. You can configure it to generate only part of the ellipsoid. The configuration available are:
|
|
Shape Create.frame
(
Object config,
Shape shape
)
A frame creates an "outline" of a box and is used to specify an area. Unlike the cuboid function, you only specify the max and min points of the box - the box is forced to be regular.
|
|
Shape Create.icosphere
(
Object config,
Shape shape
)
An icosphere is a sphere. Compared to the UV sphere it looks more regular. There is currently no support for only rendering part of this sphere.
Refer to http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html for a good description of UV vs ico spheres, and how the icosphere looks between 1-3 refines |
|
Shape Create.pyramid
(
Object config,
Shape shape
)
Creates a pyramid. Note that the faces/sides do not share vertices, as they may need to be coloured differently. The configuration available are:
|
|
Shape Create.quad
(
Object config,
Shape shape
)
Creates a rectangle. The configuration available are:
|
|
Shape Create.sphere
(
Object config,
Shape shape
)
Creates a sphere using UV mapping. You can configure it to generate only part of the sphere. The configuration available are:
|
|
Shape Create.spheroid
(
Object config,
Shape shape
)
Creates a spheroid using UV mapping. A spheroid is a sphere with different radii along two axes, so you could generate a stretched "egg". You can configure it to generate only part of the spheroid. The configuration available are:
|
|
Shape Create.triangle
(
Object config,
Shape shape
)
Creates a triangle. The configuration available are:
|
|
LineHandle Graphics.createLine
(
LineHandle ↑LineHandle,
LinesAdapter ↓LinesAdapter,
Point ↓location,
Number ↓fk
)
Creates a new LineHandle (which represents a new line) for the LinesAdapter provided. Optionally takes in a location and fk - which then forms the first vertex of this line |
|
LinesAdapter Graphics.createLinesAdapter
(
Table ↓Vertices,
Function ↓write_VID,
Function ↓write_Location,
Function ↓write_FK,
Table ↓Lines,
Function ↓write_ID,
Function ↓write_LineID,
Function ↓write_LineOrder,
Function ↓write_VertexID
)
Creates a LinesAdapter based on the two input tables and their write functions. |
|
LinesAdapter Graphics.createPresetLinesAdapter
(
Table ↓Vertices,
Table ↓Lines
)
Creates a LinesAdapter based on the two input tables Vertices and Lines. This function assumes the relevant fields in Vertices and Lines are named exactly as expected - ie. for Vertices, "ID" (ids), "Location" (points), "FK" (ids/numbers), and for Faces, "ID", "LineID", "LineOrder", "VertexID" (ids) |
|
GraphicsAdapter Graphics.createAdapter
(
Table Vertices,
Function write_VID,
Function write_Location,
Function write_FK,
Table Faces,
Function write_FID,
Function write_V1,
Function write_V2,
Function write_V3,
Function write_V4
)
Creates a GraphicsAdapter based on the two input tables and their write functions. |
|
GraphicsAdapter Graphics.createPresetAdapter
(
Table Vertices,
Table Faces
)
Creates a GraphicsAdapter based on the two input tables Vertices and Faces. This function assumes the relevant fields in Vertices and Faces are named exactly as expected - ie. for Vertices, "ID" (ids), "Location" (points), "FK" (ids), and for Faces, "ID", "V1", "V2", "V3", "V4" (ids) |
|
Shape Op.addShape
(
Shape shape,
Shape shapeToAdd
)
Adds the input shapeToAdd to the input shape. |
|
Shape Op.cloneShape
(
Shape shape
)
Clones input Shape object and returns the new Shape object |
|
Shape Op.copyShape
(
Shape shape,
Shape shapeToCopy
)
Clears a shape and makes it a copy of another shape. |
|
Shape Op.createShape
(
)
Creates an empty Shape object. |
|
Shape Op.rekeyShape
(
Shape shape,
Function keyFunction
)
Modifies the foreign key for the vertices of the input shape |
|
Shape Op.scaleAndWriteShape
(
Shape shape,
Array vec3,
GraphicsAdapter graphicsAdapter
)
Writes a scaled version of the shape. Unlike scaleShape, the input shape remains unchanged. |
|
Shape Op.scaleShape
(
Shape shape,
Array vec3
)
Scales input shape by input vector |
|
Shape Op.scaleTranslateAndWriteShape
(
Shape shape,
Array scale3,
Array translate3,
GraphicsAdapter graphicsAdapter
)
Writes a scaled and translated version of the shape. The current shape is not modified. |
|
Shape Op.transform3AndWriteShape
(
Shape shape,
glMatrix mat3,
GraphicsAdapter graphicsAdapter
)
Writes a transformed version of the shape. Unlike transform3Shape, the input shape remains unchanged. |
|
Shape Op.transform3Shape
(
Shape shape,
glMatrix mat3
)
Transforms input shape by input 3x3 matrix |
|
Shape Op.transform4AndWriteShape
(
Shape shape,
glMatrix mat4,
GraphicsAdapter graphicsAdapter
)
Writes a transformed version of the shape. Unlike transform4Shape, the input shape remains unchanged. |
|
Shape Op.transform4Shape
(
Shape shape,
glMatrix mat4
)
Transforms input shape by input 4x4 matrix |
|
Shape Op.transformViaFunctionAndWriteShape
(
Shape shape,
Function func_vec3,
GraphicsAdapter graphicsAdapter
)
Writes a transformed version of the shape. Unlike transformViaFunctionShape, the input shape remains unchanged. The transformation uses a function w = f(v), where v is an input Point and w is the returned Point. The function may modify and return the original Point rather than create a new Point. |
|
Shape Op.transformViaFunctionShape
(
Shape shape,
Function func_vec3
)
Transforms input shape by a function w = f(v), where v is an input Point and w is the returned Point. The function may modify and return the original Point rather than create a new Point. |
|
Shape Op.translateAndWriteShape
(
Shape shape,
Array vec3,
GraphicsAdapter graphicsAdapter
)
Writes a translated version of the shape. Unlike translateShape, the input shape remains unchanged. |
|
Shape Op.translateShape
(
Shape shape,
Array vec3
)
Translates input shape by input vector |
|
Op.writeShape
(
Shape shape,
GraphicsAdapter graphicsAdapter
)
Writes a Shape to a GraphicsAdapter object. |
|
Constant |
Library Path.Matrix
- an instance of the glMatrix library that Xshapes uses. |
Constant |
Object Path.shapeCommonDefaults
- common defaults for shapes. |
Number Path.cubicBezier
(
LineHandle ↓LineHandle,
Point ↓point1,
Point ↓point2,
Point ↓point3,
Point ↓point4,
Number ↓fk,
Number ↓numPoints,
Boolean ↓excludeFirst
)
Plots a cubic bezier path from point 1 to point 4 using points 2 and 3 as a reference point and writes it to the specified LineHandle. |
|
Number Path.cubicBezierSmart
(
LineHandle ↓LineHandle,
Point ↓point1,
Point ↓point2,
Point ↓point3,
Point ↓point4,
Number ↓fk,
Number ↓threshold,
Boolean ↓excludeFirst
)
Plots a cubic bezier path from point 1 to point 4 using points 2 and 3 as a reference point and writes it to the specified LineHandle. The smart variant of this function auto-generates the number of points required so that the distance between two points on the path is close to the threshold distance |
|
Number Path.linear
(
LineHandle ↓LineHandle,
Point ↓point1,
Point ↓point2,
Number ↓fk,
Number ↓numPoints,
Boolean ↓excludeFirst
)
Plots a linear path from point 1 to point 2 and writes it to the specified LineHandle. |
|
Number Path.linearSmart
(
LineHandle ↓LineHandle,
Point ↓point1,
Point ↓point2,
Number ↓fk,
Number ↓threshold,
Boolean ↓excludeFirst
)
Plots a linear path from point 1 to point 2 and writes it to the specified LineHandle. The smart variant of this function auto-generates the number of points required so that the distance between two points on the path is at most the threshold distance |
|
Number Path.quadraticBezier
(
LineHandle ↓LineHandle,
Point ↓point1,
Point ↓point2,
Point ↓point3,
Number ↓fk,
Number ↓numPoints,
Boolean ↓excludeFirst
)
Plots a quadratic bezier path from point 1 to point 3 using point2 as a reference point and writes it to the specified LineHandle. |
|
Number Path.quadraticBezierSmart
(
LineHandle ↓LineHandle,
Point ↓point1,
Point ↓point2,
Point ↓point3,
Number ↓fk,
Number ↓threshold,
Boolean ↓excludeFirst
)
Plots a quadratic bezier path from point 1 to point 3 using point2 as a reference point and writes it to the specified LineHandle. The smart variant of this function auto-generates the number of points required so that the distance between two points on the path is close to the threshold distance |
|
Shape Simple.arrow
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓foreignKey
)
Creates an arrow. |
|
Shape Simple.arrowScaled
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓foreignKey,
Number ↓maxArrowHeadLength,
Number ↓maxArrowHeadRatio,
Number ↓maxArrowHeadWidth,
Number ↓maxLineWidth,
Number ↓minArrowHeadWidth,
Number ↓minLineWidth
)
Creates an arrow. Normally arrows are scaled according to their length. This function will scale the arrowhead to a maximum size (defined by max arrow head length), such that - when the length of the arrow is small, the arrowhead is scaled. When the length of the arrow is large, the arrowhead scales up to a max size, above this size only the body of the arrow is lengthened but the arrowhead does not scale further. |
|
Shape Simple.circle
(
Shape ⇅shapeToAddTo,
Point ↓centrePoint,
Number ↓radius,
Array ↓facing,
Number ↓foreignKey
)
Creates a circle |
|
Shape Simple.cone
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓coneRadius,
Number ↓foreignKey,
Boolean ↓closeCone
)
Creates an cone. |
|
Shape Simple.cuboid
(
Shape ⇅shapeToAddTo,
Point ↓pointStart1,
Point ↓pointStart2,
Point ↓pointStart3,
Point ↓pointStart4,
Point ↓pointEnd1,
Point ↓pointEnd2,
Point ↓pointEnd3,
Point ↓pointEnd4,
Number ↓foreignKey,
Array ↓drawFaces
)
Creates a cuboid. You can create a non-regular cuboid using this function - all 8 points are specified. |
|
Shape Simple.cuboidRegular
(
Shape ⇅shapeToAddTo,
Point ↓minPoint,
Point ↓maxPoint,
Number ↓foreignKey,
Array ↓drawFaces,
Boolean ↓independentVertices
)
Creates a regular cuboid, by specifying the minimum and maximum 3D points. |
|
Shape Simple.cylinder
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓startRadius,
Number ↓endRadius,
Number ↓foreignKey,
Boolean ↓closeEnds
)
Creates a cylinder. |
|
Shape Simple.disc
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓startInnerRadius,
Number ↓startOuterRadius,
Number ↓endInnerRadius,
Number ↓endOuterRadius,
Number ↓foreignKey,
Boolean ↓closeEnds
)
Creates a disc - a hollow cylinder with a thickness - made up of an outer and inner cylinder. |
|
Shape Simple.ellipsoid
(
Shape ⇅shapeToAddTo,
Point ↓centrePoint,
Array ↓axis1,
Array ↓axis2,
Array ↓axis3,
Number ↓axis1Radius,
Number ↓axis2Radius,
Number ↓axis3Radius,
Number ↓foreignKey
)
Creates an ellipsoid using UV mapping. An ellipsoid is a sphere with different radii along three axes. |
|
Shape Simple.frame
(
Shape ⇅shapeToAddTo,
Point ↓minPoint,
Point ↓maxPoint,
Number ↓foreignKey,
Array ↓frameThickness
)
Creates a frame - an "outline" of a box that could be used to specify an area. |
|
Shape Simple.icosphere
(
Shape ⇅shapeToAddTo,
Point ↓centrePoint,
Number ↓radius,
Number ↓foreignKey,
Number ↓refines
)
Creates a icosphere. Compared to the UV sphere it looks more regular.
|
|
Shape Simple.octArrow
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓foreignKey
)
Creates an octagonal arrow. |
|
Shape Simple.octArrowScaled
(
Shape ⇅shapeToAddTo,
Point ↓startPoint,
Point ↓endPoint,
Number ↓foreignKey,
Number ↓maxArrowHeadLength,
Number ↓maxArrowHeadRatio,
Number ↓maxArrowHeadWidth,
Number ↓maxLineWidth,
Number ↓minArrowHeadWidth,
Number ↓minLineWidth
)
Creates an octagonal arrow. Normally arrows are scaled according to their length. This function will scale the arrowhead to a maximum size (defined by max arrow head length), such that - when the length of the arrow is small, the arrowhead is scaled. When the length of the arrow is large, the arrowhead scales up to a max size, above this size only the body of the arrow is lengthened but the arrowhead does not scale further. |
|
Shape Simple.pyramid
(
Shape ⇅shapeToAddTo,
Point ↓pointTop,
Point ↓pointBase1,
Point ↓pointBase2,
Point ↓pointBase3,
Point ↓pointBase4,
Number ↓foreignKey,
Array ↓drawFaces
)
Creates a pyramid. |
|
Shape Simple.quad
(
Shape ⇅shapeToAddTo,
Point ↓point1,
Point ↓point2,
Point ↓point3,
Point ↓point4,
Number ↓foreignKey
)
Creates a rectangle |
|
Shape Simple.sphere
(
Shape ⇅shapeToAddTo,
Point ↓centrePoint,
Number ↓radius,
Array ↓dirVector,
Number ↓foreignKey
)
Creates a sphere using UV mapping. |
|
Shape Simple.spheroid
(
Shape ⇅shapeToAddTo,
Point ↓centrePoint,
Number ↓widthRadius,
Number ↓longRadius,
Array ↓dirVector,
Number ↓foreignKey
)
Creates a spheroid using UV mapping. A spheroid is a sphere with different radii along two axes, so you could generate a stretched "egg". |
|
Shape Simple.tri
(
Shape ⇅shapeToAddTo,
Point ↓point1,
Point ↓point2,
Point ↓point3,
Number ↓foreignKey
)
Creates a triangle |
|
Number Utility.convertQuadsToTris
(
Table ↓Faces,
Function ↓Faces_read_ID,
Function ↓Faces_read_V1,
Function ↓Faces_read_V2,
Function ↓Faces_read_V3,
Function ↓Faces_read_V4,
Function ⇅OutputFaces_write_ID,
Function ⇅OutputFaces_write_OriginID,
Function ⇅OutputFaces_write_V1,
Function ⇅OutputFaces_write_V2,
Function ⇅OutputFaces_write_V3,
Number ↓numExtraFields,
Array ↓Faces_extraFieldsArray,
Array ⇅OutputFaces_extraFieldsArray
)
Converts a Faces table that contains triangles and quads into another Faces table that contains only triangles |
These functions create Shape objects. The functions in this category are full constructors that offer the full range of options in constructing each shape, but can be complex or cumbersome to specify. If you are after creating a quick, regular shape, take a look at the Simple category.
Creates an arrow. Vertices are shared between sides.
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created arrow to. If null, a new Shape object is created and returned.Shape
shape Creates a circle. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created circle to. If null, a new Shape object is created and returned.Shape
shape Creates an cone.
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created cone to. If null, a new Shape object is created and returned.Shape
shape Creates a cuboid. Unlike a true cuboid, this function allows you to specify all 8 points, so you could essentially have a irregular 6 sided 3D polygon.
Note that the faces/sides do not share vertices, as they may need to be coloured differently. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created cuboid to. If null, a new Shape object is created and returned.Shape
shape Creates an cylinder.
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created cylinder to. If null, a new Shape object is created and returned.Shape
shape Creates a disc. A Disc is essentially a "hollow" cylinder, being rendered from two (one inner, one outer) cylinders.
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created disc to. If null, a new Shape object is created and returned.Shape
shape Creates an ellipsoid using UV mapping. An ellipsoid is a sphere with different radii along three axes. You can configure it to generate only part of the ellipsoid. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created ellipsoid to. If null, a new Shape object is created and returned.Shape
shape A frame creates an "outline" of a box and is used to specify an area. Unlike the cuboid function, you only specify the max and min points of the box - the box is forced to be regular.
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created frame to. If null, a new Shape object is created and returned.Shape
shape An icosphere is a sphere. Compared to the UV sphere it looks more regular. There is currently no support for only rendering part of this sphere.
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created icosphere to. If null, a new Shape object is created and returned.Shape
shape Creates a pyramid. Note that the faces/sides do not share vertices, as they may need to be coloured differently. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created pyramid to. If null, a new Shape object is created and returned.Shape
shape Creates a rectangle. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created quad to. If null, a new Shape object is created and returned.Shape
shape Creates a sphere using UV mapping. You can configure it to generate only part of the sphere. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created sphere to. If null, a new Shape object is created and returned.Shape
shape Creates a spheroid using UV mapping. A spheroid is a sphere with different radii along two axes, so you could generate a stretched "egg". You can configure it to generate only part of the spheroid. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created spheroid to. If null, a new Shape object is created and returned.Shape
shape Creates a triangle. The configuration available are:
Object
config - - optional. an object containing configuration with keys/values as described.Shape
shape - - shape to add the created triangle to. If null, a new Shape object is created and returned.Shape
shape This is a bad pattern:
let shape = null;
for (let i = 0; i < Minodes.size(); ++i) {
Data.read_Location(i, config.startPoint);
config.endPoint[0] = config.startPoint[0];
config.endPoint[1] = config.startPoint[1];
config.endPoint[2] = config.startPoint[2]-1;
config.startRadius = config.endRadius = Data.read_Span(i)/2;
config.foreignKey = Data.read_ID(i);
shape = Xshapes.Create.cylinder(config, shape);
}
shape.writeShape(OutVertices, OutFaces);
shape
object will store all faces and vertices internally in JS arrays, and will eventually hit the memory limit (crashing mXrap).
let shape = null;
for (let i = 0; i < Minodes.size(); ++i) {
Data.read_Location(i, config.startPoint);
config.endPoint[0] = config.startPoint[0];
config.endPoint[1] = config.startPoint[1];
config.endPoint[2] = config.startPoint[2]-1;
config.startRadius = config.endRadius = Data.read_Span(i)/2;
config.foreignKey = Data.read_ID(i);
shape = Xshapes.Create.cylinder(config, shape);
shape.writeShape(OutVertices, OutFaces);
shape.reset();
}
reset()
call, and
writeShape()
writes out the calculated faces and vertices as it goes.
const cylinder = Xshapes.Create.cylinder(config, null);
const scale = [1,1,1];
const centre = [0,0,0];
for (let i = 0; i < Minodes.size(); ++i) {
Minodes.read_Location(i, centre);
scale[0] = scale[1] = Minodes.read_Span(i)/2;
Xshapes.Op.rekeyShape(cylinder, Minodes.read_ID(i));
cylinder.scaleTranslateAndWriteShape(scale, centre, OutVertices, OutFaces);
}
scaleTranslateAndWriteShape
function is responsible for transforming the shape's vertices and writing the transformed shape to the output. The
rekeyShape
function also adjusts the "foreign key", so that the verts have the right foreign IDs for each instance of the shape.
transform4AndWriteShape
function:
const cylinder = Xshapes.Create.cylinder(config, null);
const rotationQuat = glMatrix.quat.create(); // identity quat
const transformMat4 = glMatrix.mat4.create();
for (let i = 0; i < Minodes.size(); ++i) {
Minodes.read_Location(i, centre);
scale[0] = scale[1] = Minodes.read_Span(i)/2;
glMatrix.mat4.fromRotationTranslationScale(transformMat4,
rotationQuat, // rotation quaternion
centre, // translation vector
scale // scaling vector
);
Xshapes.Op.rekeyShape(cylinder, Minodes.read_ID(i));
cylinder.transform4AndWriteShape(transformMat4, OutVertices, OutFaces);
}
scaleTranslateAndWriteShape
method, but it also allows us to apply rotations to the generated shape. Note that
fromRotationTranslationScale
is simply a convenience method for building such a transformation matrix; it is also possible to build such a matrix from multiple elementary operations, e.g.:
glMatrix.mat4.identity(transformMat4);
glMatrix.mat4.translate(transformMat4, transformMat4, planeCentre);
glMatrix.mat4.rotateZ(transformMat4, transformMat4, -strike);
glMatrix.mat4.rotateY(transformMat4, transformMat4, dip);
glMatrix.mat4.rotateZ(transformMat4, transformMat4, rake);
transformViaFunctionAndWriteShape
method, which accepts a transformation function. The transformation function should receive a vec3 as input, and return a transformed vec3 as output (this is allowed to be the same vec3, for efficiency). As an example:
const myTransform = function(vec) {
vec[0] = scaleX * vec[0];
vec[1] = scaleY * vec[1];
glMatrix.vec3.add(vec, vec, offset);
return vec;
};
...
cylinder.transformViaFunctionAndWriteShape(myTransform, OutVertices, OutFaces);
These functions create LinesAdapter(s) and LineHandle(s).
In mXrap, surfaces are rendered using two tables, a Vertices table (describing points) and a Lines table (describing lines by linking line segments defined). A LinesAdapter object contains the configuration required to define what your Vertices and Lines tables are, and the functions to write to the relevant fields.
A LineHandle object is based off a LinesAdapter. It represents a line in progress, which you can extend by adding new vertices. You can create multiple LineHandle objects based off a LinesAdapter, and then concurrently add new vertices to them.
Creates a new LineHandle (which represents a new line) for the LinesAdapter provided. Optionally takes in a location and fk - which then forms the first vertex of this line
Parameters:LineHandle
↑LineHandle - - optional, LineHandle object to replace. A new LineHandle object is created and returned if this is null.LinesAdapter
↓LinesAdapter - - adapter to create this line in.Point
↓location - - location of first vertex, optionalNumber
↓fk - - key of first vertex, optional. Both location and fk must be provided to add the first vertex.LineHandle
↑LineHandle Creates a LinesAdapter based on the two input tables and their write functions.
Parameters:Table
↓Vertices - - vertices tableFunction
↓write_VID - - write function for vertices table, for an ids column. ID for the vertices tableFunction
↓write_Location - - write function for vertices table, for a points column. Location of the verticesFunction
↓write_FK - - write function for vertices table, for an ids column. Foreign key of the vertices.Table
↓Lines - - lines tableFunction
↓write_ID - - write function for lines table, for an ids column. Unique ID for the lines tableFunction
↓write_LineID - - write function for lines table, for an ids column. ID that determines which line this segment refers to.Function
↓write_LineOrder - - write function for lines table, for an ids column. ID that determines the order of the segments of this lineFunction
↓write_VertexID - - write function for lines table, for an ids column. ID of the vertex for this segment of the lineLinesAdapter
↑LinesAdapter Creates a LinesAdapter based on the two input tables Vertices and Lines. This function assumes the relevant fields in Vertices and Lines are named exactly as expected - ie. for Vertices, "ID" (ids), "Location" (points), "FK" (ids/numbers), and for Faces, "ID", "LineID", "LineOrder", "VertexID" (ids)
Parameters: Returns:LinesAdapter
↑LinesAdapter These functions create GraphicsAdapter(s).
In mXrap, surfaces are rendered using two tables, a Vertices table (describing points) and a Faces table (describing surfaces by linking the points defined). A GraphicsAdapter object contains the configuration required to define what your Vertices and Faces tables are, and the functions to write to the relevant fields.
Creates a GraphicsAdapter based on the two input tables and their write functions.
Parameters:Table
Vertices - - vertices tableFunction
write_VID - - write function for vertices table, for an ids column. ID for the vertices tableFunction
write_Location - - write function for vertices table, for a points column. Location of the verticesFunction
write_FK - - write function for vertices table, for an ids column. Foreign key of the vertices.Table
Faces - - faces tableFunction
write_FID - - write function for faces table, for an ids column. ID for the faces tableFunction
write_V1 - - write function for faces table, for an ids column. ID of the first vertex for this faceFunction
write_V2 - - write function for faces table, for an ids column. ID of the second vertex for this faceFunction
write_V3 - - write function for faces table, for an ids column. ID of the third vertex for this faceFunction
write_V4 - - write function for faces table, for an ids column. ID of the fourth vertex for this faceGraphicsAdapter
graphicsAdapter Creates a GraphicsAdapter based on the two input tables Vertices and Faces. This function assumes the relevant fields in Vertices and Faces are named exactly as expected - ie. for Vertices, "ID" (ids), "Location" (points), "FK" (ids), and for Faces, "ID", "V1", "V2", "V3", "V4" (ids)
Parameters: Returns:GraphicsAdapter
graphicsAdapter These functions perform operations on Shape objects.
Modifies the foreign key for the vertices of the input shape
Parameters:Shape
shape - - input shapeFunction
keyFunction - - you can specify either a value here (then the Shape will have that value for its foreign key), or a function f(location, oldKey) where location is the location of each vertex, and oldKey is the current value of the foreign key for that vertex.Shape
shape - - input shape that was rekeyedWrites a scaled version of the shape. Unlike scaleShape, the input shape remains unchanged.
Parameters:Shape
shape - - input shapeArray
vec3 - - vector defining scaling in the xyz axesGraphicsAdapter
graphicsAdapter - - the graphics adapter to write toShape
shape - - input shapeWrites a scaled and translated version of the shape. The current shape is not modified.
Parameters:Shape
shape - - input shapeArray
scale3 - - input array of 3 elements. First element is scaling for x-axis, second element is scaling for y-axis, third element is scaling for z-axisArray
translate3 - - input array of 3 elements defining the vector by which to translate the shape.GraphicsAdapter
graphicsAdapter - - the graphics adapter to write toShape
shape - - input shapeWrites a transformed version of the shape. Unlike transform3Shape, the input shape remains unchanged.
Parameters:Shape
shape - - input shapeglMatrix
mat3 - - 3x3 matrix defining transformation. Matrix is an array with elements defined according to glMatrix libraryGraphicsAdapter
graphicsAdapter - - the graphics adapter to write toShape
shape - - input shapeWrites a transformed version of the shape. Unlike transform4Shape, the input shape remains unchanged.
Parameters:Shape
shape - - input shapeglMatrix
mat4 - - 4x4 matrix defining transformation. Matrix is an array with elements defined according to glMatrix libraryGraphicsAdapter
graphicsAdapter - - the graphics adapter to write toShape
shape - - input shapeWrites a transformed version of the shape. Unlike transformViaFunctionShape, the input shape remains unchanged. The transformation uses a function w = f(v), where v is an input Point and w is the returned Point. The function may modify and return the original Point rather than create a new Point.
Parameters:Shape
shape - - input shapeFunction
func_vec3 - - input functionGraphicsAdapter
graphicsAdapter - - the graphics adapter to write toShape
shape - - input shapeTransforms input shape by a function w = f(v), where v is an input Point and w is the returned Point. The function may modify and return the original Point rather than create a new Point.
Parameters: Returns:Shape
shape - - input shape that was transformedWrites a translated version of the shape. Unlike translateShape, the input shape remains unchanged.
Parameters:Shape
shape - - input shapeArray
vec3 - - vector defining translationGraphicsAdapter
graphicsAdapter - - the graphics adapter to write toShape
shape - - input shapeWrites a Shape to a GraphicsAdapter object.
Parameters:Shape
shape GraphicsAdapter
graphicsAdapter These functions plot various curve types along a LineHandle.
Plots a cubic bezier path from point 1 to point 4 using points 2 and 3 as a reference point and writes it to the specified LineHandle.
Parameters:LineHandle
↓LineHandle - - the line handle to write to.Point
↓point1 - - point to start the pathPoint
↓point2 - - reference middle pointPoint
↓point3 - - reference middle pointPoint
↓point4 - - point to end the pathNumber
↓fk - - key for the path (when writing to the LineHandle)Number
↓numPoints - - number of points to generate on the pathBoolean
↓excludeFirst - - optional. If true, it excludes the first point on the path. This is useful when generating multiple paths on a single line.Number
↑numPointsWritten - - number of points written to the LineHandlePlots a cubic bezier path from point 1 to point 4 using points 2 and 3 as a reference point and writes it to the specified LineHandle. The smart variant of this function auto-generates the number of points required so that the distance between two points on the path is close to the threshold distance
Parameters:LineHandle
↓LineHandle - - the line handle to write to.Point
↓point1 - - point to start the pathPoint
↓point2 - - reference middle pointPoint
↓point3 - - reference middle pointPoint
↓point4 - - point to end the pathNumber
↓fk - - key for the path (when writing to the LineHandle)Number
↓threshold - - threshold distanceBoolean
↓excludeFirst - - optional. If true, it excludes the first point on the path. This is useful when generating multiple paths on a single line.Number
↑numPointsWritten - - number of points written to the LineHandlePlots a linear path from point 1 to point 2 and writes it to the specified LineHandle.
Parameters:LineHandle
↓LineHandle - - the line handle to write to.Point
↓point1 - - point to start the pathPoint
↓point2 - - point to end the pathNumber
↓fk - - key for the path (when writing to the LineHandle)Number
↓numPoints - - number of points to generate on the pathBoolean
↓excludeFirst - - optional. If true, it excludes the first point on the path. This is useful when generating multiple paths on a single line.Number
↑numPointsWritten - - number of points written to the LineHandlePlots a linear path from point 1 to point 2 and writes it to the specified LineHandle. The smart variant of this function auto-generates the number of points required so that the distance between two points on the path is at most the threshold distance
Parameters:LineHandle
↓LineHandle - - the line handle to write to.Point
↓point1 - - point to start the pathPoint
↓point2 - - point to end the pathNumber
↓fk - - key for the path (when writing to the LineHandle)Number
↓threshold - - threshold distanceBoolean
↓excludeFirst - - optional. If true, it excludes the first point on the path. This is useful when generating multiple paths on a single line.Number
↑numPointsWritten - - number of points written to the LineHandlePlots a quadratic bezier path from point 1 to point 3 using point2 as a reference point and writes it to the specified LineHandle.
Parameters:LineHandle
↓LineHandle - - the line handle to write to.Point
↓point1 - - point to start the pathPoint
↓point2 - - reference middle pointPoint
↓point3 - - point to end the pathNumber
↓fk - - key for the path (when writing to the LineHandle)Number
↓numPoints - - number of points to generate on the pathBoolean
↓excludeFirst - - optional. If true, it excludes the first point on the path. This is useful when generating multiple paths on a single line.Number
↑numPointsWritten - - number of points written to the LineHandlePlots a quadratic bezier path from point 1 to point 3 using point2 as a reference point and writes it to the specified LineHandle. The smart variant of this function auto-generates the number of points required so that the distance between two points on the path is close to the threshold distance
Parameters:LineHandle
↓LineHandle - - the line handle to write to.Point
↓point1 - - point to start the pathPoint
↓point2 - - reference middle pointPoint
↓point3 - - point to end the pathNumber
↓fk - - key for the path (when writing to the LineHandle)Number
↓threshold - - threshold distanceBoolean
↓excludeFirst - - optional. If true, it excludes the first point on the path. This is useful when generating multiple paths on a single line.Number
↑numPointsWritten - - number of points written to the LineHandleThese functions create Shape objects. The functions in this category are simple constructors that allow you to create shapes quickly with minimal options. If you are after the full range of options for each shape, take a look at the Create category.
Creates an arrow.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location pointPoint
↓endPoint - - location point. The arrow head is at the end point.Number
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates an arrow. Normally arrows are scaled according to their length. This function will scale the arrowhead to a maximum size (defined by max arrow head length), such that - when the length of the arrow is small, the arrowhead is scaled. When the length of the arrow is large, the arrowhead scales up to a max size, above this size only the body of the arrow is lengthened but the arrowhead does not scale further.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location pointPoint
↓endPoint - - location point. The arrow head is at the end point.Number
↓foreignKey - - number/ID to associate with verticesNumber
↓maxArrowHeadLength - - optional parameter, specify max length of the arrow head.Number
↓maxArrowHeadRatio - - optional parameter, usually defaults should sufficeNumber
↓maxArrowHeadWidth - - optional parameter, usually defaults should sufficeNumber
↓maxLineWidth - - optional parameter, usually defaults should sufficeNumber
↓minArrowHeadWidth - - optional parameter, used to have a minimum "width" to an arrow to enhance visibility. Will distort arrow aspect.Number
↓minLineWidth - - optional parameter, used to have a minimum "width" to an arrow to enhance visibility. Will distort arrow aspect.Shape
↑shape - - specified shape to add to or new shape created.Creates a circle
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓centrePoint - - location point of circle centerNumber
↓radius - - radius of circleArray
↓facing - - vec3 containing normal vector of circle (circle's facing)Number
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates an cone.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location point - this is the top of the conePoint
↓endPoint - - location point - this is the center of the cone base circle.Number
↓coneRadius - - radius of the cone base circle.Number
↓foreignKey - - number/ID to associate with verticesBoolean
↓closeCone - - optional, whether to render the cone base circle or not. Default true.Shape
↑shape - - specified shape to add to or new shape created.Creates a cuboid. You can create a non-regular cuboid using this function - all 8 points are specified.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓pointStart1 - - location pointPoint
↓pointStart2 - - location pointPoint
↓pointStart3 - - location pointPoint
↓pointStart4 - - location pointPoint
↓pointEnd1 - - location pointPoint
↓pointEnd2 - - location pointPoint
↓pointEnd3 - - location pointPoint
↓pointEnd4 - - location pointNumber
↓foreignKey - - number/ID to associate with verticesArray
↓drawFaces - - optional, a 6 element boolean array to specify which faces to render. Default all true. Face 0 is all the start points, Face 1 is all the end points, and the subsequent 4 faces.Shape
↑shape - - specified shape to add to or new shape created.Creates a regular cuboid, by specifying the minimum and maximum 3D points.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓minPoint - - location pointPoint
↓maxPoint - - location pointNumber
↓foreignKey - - number/ID to associate with verticesArray
↓drawFaces - - optional, a 6 element boolean array to specify which faces to render. Default all true. Face 0 is all the start points, Face 1 is all the end points, and the subsequent 4 faces.Boolean
↓independentVertices - - optional, if true then each face is guaranteed to have independent vertices (e.g. to allow for different colours on each face).Shape
↑shape - - specified shape to add to or new shape created.Creates a cylinder.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location point - this is the center of one end of the cylinderPoint
↓endPoint - - location point - this is the center of the other end of the cylinder.Number
↓startRadius - - radius of the cylinder at the startPoint end.Number
↓endRadius - - radius of the cylinder at the endPoint end.Number
↓foreignKey - - number/ID to associate with verticesBoolean
↓closeEnds - - optional, whether to render the circles at each end. Default true.Shape
↑shape - - specified shape to add to or new shape created.Creates a disc - a hollow cylinder with a thickness - made up of an outer and inner cylinder.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location point - this is the center of one end of the discPoint
↓endPoint - - location point - this is the center of the other end of the disc.Number
↓startInnerRadius - - radius of the inner cylinder at the startPoint end.Number
↓startOuterRadius - - radius of the outer cylinder at the startPoint end.Number
↓endInnerRadius - - radius of the inner cylinder at the endPoint end.Number
↓endOuterRadius - - radius of the outer cylinder at the endPoint end.Number
↓foreignKey - - number/ID to associate with verticesBoolean
↓closeEnds - - optional, whether to render the hollow circles at each end. Default true.Shape
↑shape - - specified shape to add to or new shape created.Creates an ellipsoid using UV mapping. An ellipsoid is a sphere with different radii along three axes.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓centrePoint - - location point of ellipsoid centerArray
↓axis1 - - vec3 containing direction vector of axis 1.Array
↓axis2 - - vec3 containing direction vector of axis 2.Array
↓axis3 - - vec3 containing direction vector of axis 3 - the direction in which the UV mapping points.Number
↓axis1Radius - - radius of ellipsoid along axis 1.Number
↓axis2Radius - - radius of ellipsoid along axis 2.Number
↓axis3Radius - - radius of ellipsoid along axis 3.Number
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates a frame - an "outline" of a box that could be used to specify an area.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓minPoint - - location point - this is the min point of the framePoint
↓maxPoint - - location point - this is the max point of the frameNumber
↓foreignKey - - number/ID to associate with verticesArray
↓frameThickness - - optional. The thinkness of the frame in the xyz axes. Default [0.5, 0.5, 0.5].Shape
↑shape - - specified shape to add to or new shape created.Creates a icosphere. Compared to the UV sphere it looks more regular.
Refer to http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html for a good description of UV vs ico spheres, and how the icosphere looks between 1-3 refines
Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓centrePoint - - location point - this is the center of the sphereNumber
↓radius - - radius of the sphereNumber
↓foreignKey - - number/ID to associate with verticesNumber
↓refines - - optional. The sphere starts out as a icosahedron, and then each triangle is refined into 4 triangles. This specifies the number of refines performed. The higher number of refines, the more it looks like a sphere. Do note that it gets very computationally expensive at higher values. Default 2.Shape
↑shape - - specified shape to add to or new shape created.Creates an octagonal arrow.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location pointPoint
↓endPoint - - location point. The arrow head is at the end point.Number
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates an octagonal arrow. Normally arrows are scaled according to their length. This function will scale the arrowhead to a maximum size (defined by max arrow head length), such that - when the length of the arrow is small, the arrowhead is scaled. When the length of the arrow is large, the arrowhead scales up to a max size, above this size only the body of the arrow is lengthened but the arrowhead does not scale further.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓startPoint - - location pointPoint
↓endPoint - - location point. The arrow head is at the end point.Number
↓foreignKey - - number/ID to associate with verticesNumber
↓maxArrowHeadLength - - optional parameter, specify max length of the arrow head.Number
↓maxArrowHeadRatio - - optional parameter, usually defaults should sufficeNumber
↓maxArrowHeadWidth - - optional parameter, usually defaults should sufficeNumber
↓maxLineWidth - - optional parameter, usually defaults should sufficeNumber
↓minArrowHeadWidth - - optional parameter, used to have a minimum "width" to an arrow to enhance visibility. Will distort arrow aspect.Number
↓minLineWidth - - optional parameter, used to have a minimum "width" to an arrow to enhance visibility. Will distort arrow aspect.Shape
↑shape - - specified shape to add to or new shape created.Creates a pyramid.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓pointTop - - location pointPoint
↓pointBase1 - - location pointPoint
↓pointBase2 - - location pointPoint
↓pointBase3 - - location pointPoint
↓pointBase4 - - location pointNumber
↓foreignKey - - number/ID to associate with verticesArray
↓drawFaces - - optional, a 5 element boolean array to specify which faces to render. Default all true. Face 0 is all the base points, and the subsequent 4 faces.Shape
↑shape - - specified shape to add to or new shape created.Creates a rectangle
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓point1 - - location pointPoint
↓point2 - - location pointPoint
↓point3 - - location pointPoint
↓point4 - - location pointNumber
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates a sphere using UV mapping.
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓centrePoint - - location point of sphere centerNumber
↓radius - - radius of sphereArray
↓dirVector - - vec3 containing direction vector of sphere - the direction in which the UV mapping points.Number
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates a spheroid using UV mapping. A spheroid is a sphere with different radii along two axes, so you could generate a stretched "egg".
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓centrePoint - - location point of spheroid centerNumber
↓widthRadius - - radius of spheroid around direction vectorNumber
↓longRadius - - radius of spheroid along direction vectorArray
↓dirVector - - vec3 containing direction vector of spheroid - the direction in which the UV mapping points.Number
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.Creates a triangle
Parameters:Shape
⇅shapeToAddTo - - if null, then a new shape is created and returnedPoint
↓point1 - - location pointPoint
↓point2 - - location pointPoint
↓point3 - - location pointNumber
↓foreignKey - - number/ID to associate with verticesShape
↑shape - - specified shape to add to or new shape created.These functions perform utility operations.
Converts a Faces table that contains triangles and quads into another Faces table that contains only triangles
Parameters:Table
↓Faces - - the input tableFunction
↓Faces_read_ID - - the read function for the ID field of the input tableFunction
↓Faces_read_V1 - - the read function for the Vertices 1 field of the input tableFunction
↓Faces_read_V2 - - the read function for the Vertices 2 field of the input tableFunction
↓Faces_read_V3 - - the read function for the Vertices 3 field of the input tableFunction
↓Faces_read_V4 - - the read function for the Vertices 4 field of the input tableFunction
⇅OutputFaces_write_ID - - the write function for the ID field of the output tableFunction
⇅OutputFaces_write_OriginID - - the write function for the OriginID field of the output table - this stores the ID of the input table that this output record comes fromFunction
⇅OutputFaces_write_V1 - - the write function for the Vertices 1 field of the output tableFunction
⇅OutputFaces_write_V2 - - the write function for the Vertices 2 field of the output tableFunction
⇅OutputFaces_write_V3 - - the write function for the Vertices 3 field of the output tableNumber
↓numExtraFields - - optional, the number of extra fields to bring over from the input table to the output tableArray
↓Faces_extraFieldsArray - - optional, an array containing the read functions of the extra fields for the input tableArray
⇅OutputFaces_extraFieldsArray - - optional, an array containing the write functions of the extra fields for the output tableNumber
number - of records that were written to the output tableIn mXrap, surfaces are rendered using two tables, a Vertices table (describing points) and a Faces table (describing surfaces by linking the points defined). A GraphicsAdapter object contains the configuration required to define what your Vertices and Faces tables are, and the functions to write to the relevant fields.
You can find out from on how to use GraphicsAdapter(s) in the
XShapes Tutorial
Status | Name |
---|---|
Member |
Table Faces
- Table object representing the Faces table. Has write functions for ID, V1, V2, V3, V4 (ids) |
Member |
Table Vertices
- Table object representing the Vertices table. Has write functions for ID (ids), Location (points), FK (ids) |
A LineHandle object is based off a LinesAdapter. It represents a line in progress, which you can extend by adding new vertices. You can create multiple LineHandle objects based off a LinesAdapter, and then concurrently add new vertices to them.
You can find out from on how to use LineHandle(s) in the
XLines Tutorial
Status | Name |
---|---|
LineHandle addPoint
(
Point ↓location,
Number ↓fk
)
Adds a new vertex (location and fk) for this current line. |
|
LineHandle createNewLine
(
LinesAdapter ↓LinesAdapter
)
Ends the current line and creates a new line. |
Adds a new vertex (location and fk) for this current line.
Parameters:Point
↓location - - the location of the new vertex to addNumber
↓fk - - the key of the new vertex to addLineHandle
LineHandle - - the current LineHandleEnds the current line and creates a new line.
Parameters:LinesAdapter
↓LinesAdapter - - optional, the LinesAdapter to create the new line in. If its the same LinesAdapter as before, it can be omitted.LineHandle
LineHandle - - the current LineHandleIn mXrap, surfaces are rendered using two tables, a Vertices table (describing points) and a Lines table (describing lines by linking the points defined). A LinesAdapter object contains the configuration required to define what your Vertices and Lines tables are, and the functions to write to the relevant fields.
You can find out from on how to use LinesAdapter(s) in the
XLines Tutorial
Status | Name |
---|---|
Member |
Table Lines
- Table object representing the Faces table. Has write functions for ID, V1, V2, V3, V4 (ids) |
Member |
Table Vertices
- Table object representing the Vertices table. Has write functions for ID (ids), Location (points), FK (ids) |
A Shape object contains a number of vertices and faces that can be transformed as a whole and then written out to a GraphicsAdapter object.
Each basic surfaces object, e.g. a cone, pyramid or sphere, is a Shape. You can combine several Shape objects using addShape into a complex Shape, which you can then transform (rotate, translate, stretch, etc) as a whole.
You can clone Shape objects too - it is useful when you have to put the same shape, e.g. sphere, in multiple locations/orientations.
Status | Name |
---|---|
Shape addShape
(
Shape shapeToAdd
)
Adds the input Shape object into this Shape object. |
|
Shape cloneShape
(
)
Clones this Shape object and returns the new Shape object |
|
Shape copyShape
(
Shape shapeToCopy
)
Clears the current shape and makes it a copy of the input shape. Note - this function has changed. It previously was the same as cloneShape. |
|
Number getFacesCount
(
)
Returns the number of faces in the shape. |
|
Number getVerticesCount
(
)
Returns the number of vertices in the shape. |
|
Shape loadFromText
(
Text text
)
Load a shape from text. |
|
Shape printShape
(
)
Prints a representation of the vertices and faces in this shape into the debug window. |
|
Shape rekeyShape
(
Function keyFunction
)
Modifies the foreign key for the vertices of this shape. |
|
Text saveAsText
(
)
Saves a representation of this object to text |
|
Shape scaleAndWriteShape
(
Array vec3,
GraphicsAdapter graphicsAdapter
)
Writes a scaled version of the shape. The current shape is not modified. |
|
Shape scaleShape
(
Array vec3
)
Scales the shape according to the input array of 3 elements |
|
Shape scaleTranslateAndWriteShape
(
Array scale3,
Array translate3,
GraphicsAdapter graphicsAdapter
)
Writes a scaled and translated version of the shape. The current shape is not modified. |
|
Shape transform3AndWriteShape
(
glMatrix matrix,
GraphicsAdapter graphicsAdapter
)
Writes a transformed version of the shape. The current shape is not modified. |
|
Shape transform3Shape
(
glMatrix matrix
)
Transforms the shape according to the input 3x3 transformation matrix |
|
Shape transform4AndWriteShape
(
glMatrix matrix,
GraphicsAdapter graphicsAdapter
)
Writes a transformed version of the shape. The current shape is not modified. |
|
Shape transform4Shape
(
glMatrix matrix
)
Transforms the shape according to the input 4x4 transformation matrix |
|
Shape transformViaFunctionAndWriteShape
(
Function func_vec3,
GraphicsAdapter graphicsAdapter
)
Writes a transformed version of the shape. The current shape is not modified. The input function w = f(v), where v is the input Point and w the returned (modified) Point. It is recommended to modify and return the input Point rather than to create a new Point each time. |
|
Shape transformViaFunctionShape
(
Function func_vec3
)
Transforms the shape according to a input function w = f(v), where v is the input Point and w the returned (modified) Point. It is recommended to modify and return the input Point rather than to create a new Point each time. |
|
Shape translateAndWriteShape
(
Array vec3,
GraphicsAdapter graphicsAdapter
)
Writes a translated version of the shape. The current shape is not modified. |
|
Shape translateShape
(
Array vec3
)
Translates (moves) the shape. |
|
Shape writeShape
(
GraphicsAdapter graphicsAdapter
)
Writes out the shape to the GraphicsAdapter object specified. |
Prints a representation of the vertices and faces in this shape into the debug window.
Parameters:Shape
currentShape Modifies the foreign key for the vertices of this shape.
Parameters:Function
keyFunction - - you can specify either a value here (then the Shape will have that value for its foreign key), or a function f(location, oldKey) where location is the location of each vertex, and oldKey is the current value of the foreign key for that vertex.Shape
currentShape Saves a representation of this object to text
Parameters:Text
text - - text representation of this Shape objectWrites a scaled version of the shape. The current shape is not modified.
Parameters:Array
vec3 - - input array of 3 elements. First element is scaling for x-axis, second element is scaling for y-axis, third element is scaling for z-axisGraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape Writes a scaled and translated version of the shape. The current shape is not modified.
Parameters:Array
scale3 - - input array of 3 elements. First element is scaling for x-axis, second element is scaling for y-axis, third element is scaling for z-axisArray
translate3 - - input array of 3 elements defining the vector by which to translate the shape.GraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape Writes a transformed version of the shape. The current shape is not modified.
Parameters:glMatrix
matrix - - input 3x3 transformation matrixGraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape Writes a transformed version of the shape. The current shape is not modified.
Parameters:glMatrix
matrix - - input 4x4 transformation matrixGraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape Writes a transformed version of the shape. The current shape is not modified. The input function w = f(v), where v is the input Point and w the returned (modified) Point. It is recommended to modify and return the input Point rather than to create a new Point each time.
Parameters:Function
func_vec3 - - input functionGraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape Transforms the shape according to a input function w = f(v), where v is the input Point and w the returned (modified) Point. It is recommended to modify and return the input Point rather than to create a new Point each time.
Parameters:Function
func_vec3 - - input functionShape
currentShape Writes a translated version of the shape. The current shape is not modified.
Parameters:Array
vec3 - - input array of 3 elements defining the vector by which to translate the shape.GraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape Writes out the shape to the GraphicsAdapter object specified.
Parameters:GraphicsAdapter
graphicsAdapter - - the GraphicsAdapter object to write this shape to.Shape
currentShape