Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

View project on GitHub Star

Api - measure Namespace

Index

Functions

augment

boundingHexagon

  • Measures the minimum bounding hexagon surrounding a model. The hexagon is oriented such that the right and left sides are vertical, and the top and bottom are pointed.

    Parameters

    • modelToMeasure: IModel

      The model to measure.

    Returns IBoundingHex

    IBoundingHex object which is a hexagon model, with an additional radius property.

increase

  • Increase a measurement by an additional measurement.

    Parameters

    • baseMeasure: IMeasure

      The measurement to increase.

    • addMeasure: IMeasure

      The additional measurement.

    • Optional augmentBaseMeasure: boolean

      Optional flag to call measure.augment on the measurement.

    Returns IMeasure

    The increased original measurement (for cascading).

isAngleEqual

  • isAngleEqual(angleA: number, angleB: number, accuracy?: number): boolean
  • Find out if two angles are equal.

    Parameters

    • angleA: number

      First angle.

    • angleB: number

      Second angle.

    • Default value accuracy: number = 0.0001

    Returns boolean

    true if angles are the same, false if they are not

isArcConcaveTowardsPoint

  • isArcConcaveTowardsPoint(arc: IPathArc, towardsPoint: IPoint): boolean

isArcOverlapping

  • isArcOverlapping(arcA: IPathArc, arcB: IPathArc, excludeTangents: boolean): boolean

isArcSpanOverlapping

  • isArcSpanOverlapping(arcA: IPathArc, arcB: IPathArc, excludeTangents: boolean): boolean
  • Check for arc overlapping another arc.

    Parameters

    • arcA: IPathArc

      The arc to test.

    • arcB: IPathArc

      The arc to check for overlap.

    • excludeTangents: boolean

      Boolean to exclude exact endpoints and only look for deep overlaps.

    Returns boolean

    Boolean true if arcA is overlapped with arcB.

isBetween

  • isBetween(valueInQuestion: number, limitA: number, limitB: number, exclusive: boolean): boolean
  • Check if a given number is between two given limits.

    Parameters

    • valueInQuestion: number

      The number to test.

    • limitA: number

      First limit.

    • limitB: number

      Second limit.

    • exclusive: boolean

      Flag to exclude equaling the limits.

    Returns boolean

    Boolean true if value is between (or equal to) the limits.

isBetweenArcAngles

  • isBetweenArcAngles(angleInQuestion: number, arc: IPathArc, exclusive: boolean): boolean
  • Check if a given angle is between an arc's start and end angles.

    Parameters

    • angleInQuestion: number

      The angle to test.

    • arc: IPathArc

      Arc to test against.

    • exclusive: boolean

      Flag to exclude equaling the start or end angles.

    Returns boolean

    Boolean true if angle is between (or equal to) the arc's start and end angles.

isBetweenPoints

  • isBetweenPoints(pointInQuestion: IPoint, line: IPathLine, exclusive: boolean): boolean
  • Check if a given point is between a line's end points.

    Parameters

    • pointInQuestion: IPoint

      The point to test.

    • line: IPathLine

      Line to test against.

    • exclusive: boolean

      Flag to exclude equaling the origin or end points.

    Returns boolean

    Boolean true if point is between (or equal to) the line's origin and end points.

isBezierSeedLinear

  • Check if a given bezier seed has all points on the same slope.

    Parameters

    • seed: IPathBezierSeed

      The bezier seed to test.

    • Optional exclusive: boolean

      Optional boolean to test only within the boundary of the endpoints.

    Returns boolean

    Boolean true if bezier seed has control points on the line slope and between the line endpoints.

isChainClockwise

  • isChainClockwise(chainContext: IChain, out_result?: object): boolean
  • Check for flow of paths in a chain being clockwise or not.

    Parameters

    • chainContext: IChain

      The chain to test.

    • Optional out_result: object

      Optional output object, if provided, will be populated with convex hull results.

      • Optional hullPoints?: IPoint[]
      • Optional keyPoints?: IPoint[]

    Returns boolean

    Boolean true if paths in the chain flow clockwise.

isLineOverlapping

  • isLineOverlapping(lineA: IPathLine, lineB: IPathLine, excludeTangents: boolean): boolean

isMeasurementOverlapping

isPathEqual

  • isPathEqual(pathA: IPath, pathB: IPath, withinPointDistance?: number, pathAOffset?: IPoint, pathBOffset?: IPoint): boolean

isPointArrayClockwise

  • isPointArrayClockwise(points: IPoint[], out_result?: object): boolean
  • Check for array of points being clockwise or not.

    Parameters

    • points: IPoint[]

      The array of points to test.

    • Optional out_result: object

      Optional output object, if provided, will be populated with convex hull results.

      • Optional hullPoints?: IPoint[]
      • Optional keyPoints?: IPoint[]

    Returns boolean

    Boolean true if points flow clockwise.

isPointDistinct

  • isPointDistinct(pointToCheck: IPoint, pointArray: IPoint[], withinDistance?: number): boolean
  • Find out if a point is distinct among an array of points.

    Parameters

    • pointToCheck: IPoint

      point to check.

    • pointArray: IPoint[]

      array of points.

    • Optional withinDistance: number

      Optional distance to consider points equal.

    Returns boolean

    false if point is equal to any point in the array.

isPointEqual

  • isPointEqual(a: IPoint, b: IPoint, withinDistance?: number): boolean

isPointInsideModel

isPointOnCircle

isPointOnPath

  • Find out if a point lies on a path.

    Parameters

    • pointToCheck: IPoint

      point to check.

    • onPath: IPath

      path to check against.

    • Default value withinDistance: number = 0

      Optional distance to consider point on the path.

    • Optional pathOffset: IPoint

      Optional offset of path from [0, 0].

    • Optional options: IIsPointOnPathOptions

      Optional IIsPointOnPathOptions to cache computation.

    Returns boolean

isPointOnSlope

  • isPointOnSlope(p: IPoint, slope: ISlope, withinDistance?: number): boolean

isSlopeEqual

isSlopeParallel

lineSlope

modelExtents

modelPathLength

  • modelPathLength(modelToMeasure: IModel): number

pathExtents

pathLength

  • pathLength(pathToMeasure: IPath): number

pointDistance

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc