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 Module

Index

Variables

Private pathAreEqualMap

pathAreEqualMap: IPathAreEqualMap

Private pathExtentsMap

pathExtentsMap: object

Type declaration

Private pathLengthMap

pathLengthMap: object

Type declaration

  • [pathType: string]: function
      • (pathToMeasure: IPath): number
      • Parameters

        Returns number

Functions

Private cloneMeasure

Private getExtremePoint

increase

  • Increase a measurement by an additional measurement.

    Parameters

    • baseMeasure: IMeasure

      The measurement to increase.

    • addMeasure: IMeasure

      The additional measurement.

    Returns IMeasure

    The increased original measurement (for chaining).

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
  • Check for arc being concave or convex towards a given point.

    Parameters

    • arc: IPathArc

      The arc to test.

    • towardsPoint: IPoint

      The point to test.

    Returns boolean

    Boolean true if arc is concave towards point.

isArcOverlapping

  • isArcOverlapping(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 is simply a line.

    Parameters

    Returns boolean

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

isLineOverlapping

  • isLineOverlapping(lineA: IPathLine, lineB: IPathLine, excludeTangents: boolean): boolean
  • Check for line overlapping another line.

    Parameters

    • lineA: IPathLine

      The line to test.

    • lineB: IPathLine

      The line to check for overlap.

    • excludeTangents: boolean

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

    Returns boolean

    Boolean true if lineA is overlapped with lineB.

isMeasurementOverlapping

  • Check for measurement overlapping another measurement.

    Parameters

    • measureA: IMeasure

      The measurement to test.

    • measureB: IMeasure

      The measurement to check for overlap.

    Returns boolean

    Boolean true if measureA is overlapped with measureB.

isPathEqual

  • isPathEqual(pathA: IPath, pathB: IPath, withinPointDistance?: number, pathAOffset?: IPoint, pathBOffset?: IPoint): boolean
  • Find out if two paths are equal.

    Parameters

    • pathA: IPath

      First path.

    • pathB: IPath

      Second path.

    • Optional withinPointDistance: number
    • Optional pathAOffset: IPoint
    • Optional pathBOffset: IPoint

    Returns boolean

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

isPointEqual

  • isPointEqual(a: IPoint, b: IPoint, withinDistance?: number): boolean
  • Find out if two points are equal.

    Parameters

    • a: IPoint

      First point.

    • b: IPoint

      Second point.

    • Optional withinDistance: number

    Returns boolean

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

isPointOnSlope

  • isPointOnSlope(p: IPoint, slope: ISlope, withinDistance?: number): boolean
  • Find out if point is on a slope.

    Parameters

    • p: IPoint

      Point to check.

    • slope: ISlope
    • Optional withinDistance: number

    Returns boolean

    true if point is on the slope

isSlopeEqual

  • Check for slope equality.

    Parameters

    • slopeA: ISlope

      The ISlope to test.

    • slopeB: ISlope

      The ISlope to check for equality.

    Returns boolean

    Boolean true if slopes are equal.

lineSlope

modelExtents

  • Measures the smallest rectangle which contains a model.

    Parameters

    • modelToMeasure: IModel

      The model to measure.

    • Optional atlas: Atlas

      Optional atlas to save measurements.

    Returns IMeasure

    object with low and high points.

pathExtents

  • Calculates the smallest rectangle which contains a path.

    Parameters

    • pathToMeasure: IPath

      The path to measure.

    • Optional addOffset: IPoint

    Returns IMeasure

    object with low and high points.

pathLength

  • pathLength(pathToMeasure: IPath): number
  • Measures the length of a path.

    Parameters

    • pathToMeasure: IPath

      The path to measure.

    Returns number

    Length of the path.

pointDistance

  • Calculates the distance between two points.

    Parameters

    Returns number

    Distance between points.

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