DrawingUtilityFunctions.kl

Functions

getOrCreateLines

InlineLinesShape getOrCreateLines ( io InlineTransform rootTransform, in String name, in Color color, in Xfo xfo )

Looks under the given transform for a child wth the given name and returns it, else sets up a new lines shape with the given name. If the shape already exists under the given name, the color will be updated to the color value provided.

/*
** Example: getOrCreateLines :nooutput:
*/

DrawingHandle handle('DrawingHandle');

InlineTransform root = handle.getRootTransform();

InlineLinesShape linesShape = getOrCreateLines(rootTransform, 'MyLines', Color(1.0,0.0,0.0));

// Clear the linse and re-generate the shape based on the current evaluation data. 
Lines lines = linesShape.getLines();
lines.clear();
lines.addLine(start, end);

getOrCreateLines

InlineLinesShape getOrCreateLines ( io InlineTransform rootTransform, in String name, in Color color, in Xfo xfo )

Looks under the given transform for a child wth the given name and returns it, else sets up a new lines shape with the given name. If the shape already exists under the given name, the color will be updated to the color value provided.

/*
** Example: getOrCreateLines :nooutput:
*/

DrawingHandle handle('DrawingHandle');

InlineTransform root = handle.getRootTransform();

InlineLinesShape linesShape = getOrCreateLines(rootTransform, 'MyLines', Color(1.0,0.0,0.0));

// Clear the linse and re-generate the shape based on the current evaluation data. 
Lines lines = linesShape.getLines();
lines.clear();
lines.addLine(start, end);

getOrCreatePoints

InlinePointsShape getOrCreatePoints ( io InlineTransform rootTransform, in String name, in Color color )

Looks under the given transform for a child wth the given name and returns it, else sets up a new points shape with the given name. If the shape already exists under the given name, the color will be updated to the color value provided.

/*
** Example: getOrCreatePoints :nooutput:
*/

DrawingHandle handle('DrawingHandle');
InlineTransform root = handle.getRootTransform();
InlinePointsShape pointsShape = getOrCreatePoints(rootTransform, 'MyPoints', Color(1.0,0.0,0.0));

// Clear the points and re-generate the shape based on the current evaluation data. 
Points points = pointsShape.getPoints();
points.clear();
points.addPoint(Vec3(x, y, z));

getOrCreateMesh

InlineMeshShape getOrCreateMesh ( io InlineTransform rootTransform, in String name, in Color color )

Looks under the given transform for a child wth the given name and returns it, else sets up a new mesh shape with the given name. If the shape already exists under the given name, the color will be updated to the color value provided.

/*
** Example: getOrCreateMesh :nooutput:
*/

DrawingHandle handle('DrawingHandle');
InlineTransform root = handle.getRootTransform();
InlineMeshShape meshShape = getOrCreateMesh(rootTransform, 'MyMesh', Color(1.0,0.0,0.0));

// Clear the mesh and re-generate the shape based on the current evaluation data. 
PolygonMesh mesh = meshShape.getmesh();
mesh.clear();
// Add mesh data here...

drawFlatShapeAtXfo

InlineTransform drawFlatShapeAtXfo ( io InlineTransform rootTransform, in String name, in InlineShape shape, in Color color, in Xfo xfo )

Sets up a new InlineInstance with the given name using a flat shader using the specified color.

drawLine

InlineLinesShape drawLine ( io InlineTransform rootTransform, in String name, in Vec3 start, in Vec3 end, in Color color )

Draws a line between 2 position values.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
start The start position of the generated line.
end The end position of the generated line.
color The color of the generated shape.

drawLineStrip

InlineLinesShape drawLineStrip ( io InlineTransform rootTransform, in String name, in Vec3 positions[], in Color color )

Draws a line strip through the given position values.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
positions The array position values used to generate the line.
color The color of the generated shape.

drawPoints

InlinePointsShape drawPoints ( io InlineTransform rootTransform, in String name, in Vec3 positions[], in Color color, in Float32 size )

Draws a collection of points at the given position values.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
positions The array position values used to generate the points.
color The color of the generated shape.

drawVectorLines

InlineLinesShape drawVectorLines ( io InlineTransform rootTransform, in String name, in Vec3 positions[], in Color color )

Draws a collection of line segements connecting pairs of values on the positions array.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
positions The array position values used to generate the line segments.
color The color of the generated shape.

drawCircle

InlineTransform drawCircle ( io InlineTransform rootTransform, in String name, in Xfo xfo, in Scalar radius, in Color color )

Draws a circle at the given transform and color.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.
radius The radius of the generated circle.
color The color of the generated shape.

drawLinesSphere

InlineTransform drawLinesSphere ( io InlineTransform rootTransform, in String name, in Xfo xfo, in Scalar radius, in Color color )

Draws a sphere made up of 3 orthogonal circles at the given transform and color.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.
radius The radius of the generated sphere shape.
color The color of the generated shape.

drawCross

InlineTransform drawCross ( io InlineTransform rootTransform, in String name, in Xfo xfo, in Scalar size, in Color color )

Draws a cross made up of 3 orthogonal line segments at the given transform and color.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.
size The size of the generated cross shape.
color The color of the generated shape.

drawRectangle

InlineTransform drawRectangle ( io InlineTransform rootTransform, in String name, in Xfo xfo, in Scalar length, in Scalar width, in Color color )

Draws a rectangle at the given transform and color.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.
length The length of the generated rectangle shape.
width The width of the generated rectangle shape.
color The color of the generated shape.

drawSphere

InlineTransform drawSphere ( io InlineTransform rootTransform, in String name, in Xfo xfo, in Scalar radius, in Color color )

Draws a Sphere using a PolygonMesh at the specified Xfo.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.
radius The radius of the generated sphere shape.
color The color of the generated shape.

drawArrow

InlineTransform drawArrow ( io InlineTransform rootTransform, in String name, in Xfo xfo, in Color color )

Draws an Arrow using a cylinder and Cone. The size of the displayed arros is controlled by the scale factor of the provided xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.
color The color of the generated shape.

drawXfo

InlineTransform drawXfo ( io InlineTransform rootTransform, in String name, in Xfo xfo )

Draws an Xfo using 3 colored arrows. The size of the displayed Xfo is driven by the scale factor of the xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.

drawXfo

InlineTransform drawXfo ( io InlineTransform rootTransform, in String name, in Xfo xfo )

Draws an Xfo using 3 colored arrows. The size of the displayed Xfo is driven by the scale factor of the xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.

drawXfo

InlineTransform drawXfo ( io InlineTransform rootTransform, in String name, in Xfo xfo )

Draws an Xfo using 3 colored arrows. The size of the displayed Xfo is driven by the scale factor of the xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfo The transform of the shape relative to the provided root transform.

drawXfoArray

InlineTransform drawXfoArray ( io InlineTransform rootTransform, in String name, in Xfo xfos[] )

Draws an array of Xfos using 3 colored arrows. The size of the displayed Xfo is driven by the scale factor of the xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfos The transforms of the generated xfos relative to the provided root transform.

drawXfoArray

InlineTransform drawXfoArray ( io InlineTransform rootTransform, in String name, in Xfo xfos[] )

Draws an array of Xfos using 3 colored arrows. The size of the displayed Xfo is driven by the scale factor of the xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfos The transforms of the generated xfos relative to the provided root transform.

drawXfoArray

InlineTransform drawXfoArray ( io InlineTransform rootTransform, in String name, in Xfo xfos[] )

Draws an array of Xfos using 3 colored arrows. The size of the displayed Xfo is driven by the scale factor of the xfo parameter.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
xfos The transforms of the generated xfos relative to the provided root transform.

drawAngle

InlineLinesShape drawAngle ( io InlineTransform rootTransform, in String name, in Vec3 shapeAxis, in Float32 shapeAngle, in Xfo xfo, in Color color, in Scalar radius )

Draws an arc around the given axis for displaying an angle value in 3d.

rootTransform The InlineTransform which will own the generated shape object.
name The name of the generated shape object.
shapeAxis The axis to use when generating the arc
shapeAngle The angle to use when generating the arc
xfo The transform of the shape relative to the provided root transform.ts.
color The color of the generated shape.
radius The radius of the arc shape.