Options
All
  • Public
  • Public/Protected
  • All
Menu

Tool functions for GreasedLine

Hierarchy

  • GreasedLineTools

Index

Constructors

Methods

  • GetArrowCap(position: Vector3, direction: Vector3, length: number, widthUp: number, widthDown: number, widthStartUp?: number, widthStartDown?: number): { points: Vector3[]; widths: number[] }
  • 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[] }

  • Gets line points in a shape of a bezier curve

    Parameters

    • p0: Vector3

      bezier point0

    • p1: Vector3

      bezier point1

    • p2: Vector3

      bezier point2

    • segments: number

      number of segments in the curve

    Returns number[]

  • GetCircleLinePoints(radiusX: number, segments: number, z?: number, radiusY?: number, segmentAngle?: number): Vector3[]
  • 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

  • GetLineLength(data: number[] | Vector3[]): number
  • 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

  • Gets line segments. A segment is a part of the line between it's two points.

    Parameters

    Returns { length: number; point1: Vector3; point2: Vector3 }[]

    segments information of the line segment including starting point, ending point and the distance between them

  • GetMinMaxSegmentLength(points: Vector3[]): { max: number; min: number }
  • 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

    Returns { max: number; min: number }

    • max: number
    • min: number
  • GetPointsCountInfo(points: number[][]): { counts: number[]; total: number }
  • 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
  • GetPointsFromText(text: string, size: number, resolution: number, fontData: IFontData, z?: number, includeInner?: boolean): number[][]
  • 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

  • GetPositionOnLineByVisibility(lineSegments: { length: number; point1: Vector3; point2: Vector3 }[], lineLength: number, visbility: number, localSpace?: boolean): Vector3
  • 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

  • Omit zero length lines predicate for the MeshesToLines function

    Parameters

    • p1: Vector3

      point1 position of the face

    • p2: Vector3

      point2 position of the face

    • p3: Vector3

      point3 position of the face

    Returns boolean

  • SegmentizeLineBySegmentCount(what: Vector3[], segmentCount: number): Vector3[]
  • Divides a line into segments. A segment is a part of the line between it's two points.

    Parameters

    • what: Vector3[]

      line points

    • segmentCount: number

      number of segments

    Returns Vector3[]

    line point

  • SegmentizeLineBySegmentLength(what: number[] | Vector3[] | { length: number; point1: Vector3; point2: Vector3 }[], segmentLength: number): Vector3[]
  • 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

  • Divides a segment into smaller segments. A segment is a part of the line between it's two points.

    Parameters

    • point1: Vector3

      first point of the line

    • point2: Vector3

      second point of the line

    • segmentCount: number

      number of segments we want to have in the divided line

    Returns Vector3[]

  • ToNumberArray(points: Vector3[]): number[]
  • 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

    Returns number[]

    an array of x, y, z coordinates as numbers [x, y, z, x, y, z, x, y, z, ....]

  • ToVector3Array(points: number[]): Vector3[]
  • Converts number coordinates to Vector3s

    Parameters

    • points: number[]

      number array of x, y, z, x, y z, ... coordinates

    Returns Vector3[]

    Vector3 array

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme