Class GreasedLineTools
Hierarchy
- GreasedLineTools
Index
Constructors
Methods
- Get
Arrow Cap - Get
Bezier Line Points - Get
Circle Line Points - Get
Line Length - Get
Line Segments - Get
Min Max Segment Length - Get
Points Count Info - Get
Points From Text - Get
Position On Line By Visibility - Meshes
To Lines - Omit
Zero Length Predicate - Segmentize
Line By Segment Count - Segmentize
Line By Segment Length - Segmentize
Segment By Count - To
Number Array - To
Vector3 Array
Constructors
constructor
Returns GreasedLineTools
Methods
Static Get Arrow CapSearch playground for GetArrowCap
Parameters
position: Vector3
position of the arrow cap (mainly you want to create a triangle, set widthUp and widthDown to the same value and omit widthStartUp and widthStartDown)
direction: Vector3
direction which the arrow points to
length: number
length (size) of the arrow cap itself
widthUp: number
the arrow width above the line
widthDown: number
the arrow width belove the line
Optional widthStartUp: number
the arrow width at the start of the arrow above the line. In most scenarios this is 0.
Optional widthStartDown: number
the arrow width at the start of the arrow below the line. In most scenarios this is 0.
Returns { points: Vector3[]; widths: number[] }
points: Vector3[]
widths: number[]
Static Get Bezier Line PointsSearch playground for GetBezierLinePoints
Static Get Circle Line PointsSearch playground for GetCircleLinePoints
Creates lines in a shape of circle/arc. A segment is a part of the line between it's two points.
Parameters
radiusX: number
radiusX of the circle
segments: number
number of segments in the circle
Optional z: number
z coordinate of the points. Defaults to 0.
Optional radiusY: number
radiusY of the circle - you can draw an oval if using different values
Optional segmentAngle: number
angle offset of the segments. Defaults to Math.PI * 2 / segments. Change this value to draw a part of the circle.
Returns Vector3[]
line points
Static Get Line LengthSearch playground for GetLineLength
Gets the length of the line counting all it's segments length
Parameters
data: number[] | Vector3[]
array of line points
Returns number
length of the line
Static Get Line SegmentsSearch playground for GetLineSegments
Static Get Min Max Segment LengthSearch playground for GetMinMaxSegmentLength
Gets the minimum and the maximum length of a line segment in the line. A segment is a part of the line between it's two points.
Parameters
points: Vector3[]
line points
Returns { max: number; min: number }
max: number
min: number
Static Get Points Count InfoSearch playground for GetPointsCountInfo
Calculates the sum of points of every line and the number of points in each line. This function is useful when you are drawing multiple lines in one mesh and you want to know the counts. For example for creating an offsets table.
Parameters
points: number[][]
point array
Returns { counts: number[]; total: number }
points count info
counts: number[]
total: number
Static Get Points From TextSearch playground for GetPointsFromText
Gets 3D positions of points from a text and font
Parameters
text: string
Text
size: number
Size of the font
resolution: number
Resolution of the font
fontData: IFontData
defines the font data (can be generated with http://gero3.github.io/facetype.js/)
Optional z: number
z coordinate
Optional includeInner: boolean
include the inner parts of the font in the result. Default true. If false, only the outlines will be returned.
Returns number[][]
number[][] of 3D positions
Static Get Position On Line By VisibilitySearch playground for GetPositionOnLineByVisibility
Finds the last visible position in world space of the line according to the visibility parameter
Parameters
lineSegments: { length: number; point1: Vector3; point2: Vector3 }[]
segments of the line
lineLength: number
total length of the line
visbility: number
normalized value of visibility
Optional localSpace: boolean
Returns Vector3
world space coordinate of the last visible piece of the line
Static Meshes To LinesSearch playground for MeshesToLines
Gets mesh triangles as line positions
Parameters
meshes: AbstractMesh[]
array of meshes
Optional predicate: ((p1: Vector3, p2: Vector3, p3: Vector3, indiceIndex: number, vertexIndex: number, mesh: AbstractMesh, meshIndex: number, vertices: FloatArray, indices: IndicesArray) => Vector3[])
predicate function which decides whether to include the mesh triangle/face in the ouput
Parameters
p1: Vector3
p2: Vector3
p3: Vector3
indiceIndex: number
vertexIndex: number
mesh: AbstractMesh
meshIndex: number
vertices: FloatArray
indices: IndicesArray
Returns Vector3[]
Returns Vector3[][]
array of arrays of points
Static Omit Zero Length PredicateSearch playground for OmitZeroLengthPredicate
Static Segmentize Line By Segment CountSearch playground for SegmentizeLineBySegmentCount
Static Segmentize Line By Segment LengthSearch playground for SegmentizeLineBySegmentLength
Divides a line into segments. A segment is a part of the line between it's two points.
Parameters
what: number[] | Vector3[] | { length: number; point1: Vector3; point2: Vector3 }[]
line points
segmentLength: number
length of each segment of the resulting line (distance between two line points)
Returns Vector3[]
line point
Static Segmentize Segment By CountSearch playground for SegmentizeSegmentByCount
Static To Number ArraySearch playground for ToNumberArray
Gets a number array from a Vector3 array. You can you for example to convert your Vector3[] offsets to the required number[] for the offsets option.
Parameters
points: Vector3[]
Vector3 array
Returns number[]
an array of x, y, z coordinates as numbers [x, y, z, x, y, z, x, y, z, ....]
Static To Vector3 ArraySearch playground for ToVector3Array
Converts number coordinates to Vector3s
Parameters
points: number[]
number array of x, y, z, x, y z, ... coordinates
Returns Vector3[]
Vector3 array
Tool functions for GreasedLine