iink-ts - v5.0.0
    Preparing search index...

    Class PointSet2d

    Hierarchy (View Summary)

    Index
    • get bounds(): TOBB

      The smallest box containing every vertex, measured in this shape's own frame.

      Axis-aligned while frameAngle is zero, and turned with the shape once it is not — which is what keeps a rotated shape's box tight instead of letting it grow to the axis-aligned box around the turned one.

      Returns TOBB

    • get edges(): TSegment[]

      The segments between consecutive vertices, plus the closing one when isClosed.

      That closing edge is the whole of what isClosed changes here, and it is not cosmetic: without it a polygon's last side is missing from every edge-crossing test, so a query touching only that side would report no overlap.

      Returns TSegment[]

    • get length(): number

      Total length along the edges — a perimeter when isClosed, a path length otherwise.

      Returns number

    • get vertices(): TPoint[]

      Returns TPoint[]

    • The points this shape is made of, in order.

      A curve tessellates here — there is no exact vertex list for a circle, and the subclass that draws one decides how finely to approximate it. A shape whose test does not need an approximation overrides the methods that would use it instead.

      Implemented rather than exposed directly so the result can be held: see the class note.

      Returns TPoint[]

    • Whether point is inside this shape's outline.

      Always false for an unfilled shape: there is no inside to be in. Callers wanting "on or near the outline" want hitTestPoint.

      Parameters

      Returns boolean

    • Distance from point to this shape's outline. Zero on the outline, positive on either side.

      Parameters

      Returns number

    • Whether point hits this shape, allowing margin of slack around its outline.

      Inside a filled shape counts however far from the outline it is — that is what filled means.

      Parameters

      • point: TPoint
      • margin: number = 0

      Returns boolean

    • This shape's points carried through matrix, for a subclass to hand to the shape it builds.

      Exact however the matrix turns or scales — a point maps to a point, with nothing to approximate and no accumulated tessellation error to carry.

      Parameters

      Returns TPoint[]

    • Whether any sample falls inside the query, bounds included.

      Inclusive on every side, so a sample exactly on the query's edge counts — a selection dragged to land precisely on a point is a selection of it.

      Parameters

      Returns boolean

    • This shape carried through matrix.

      Abstract because only the shape knows what it stays under a transform: a circle scaled by different factors on each axis is an ellipse, not a circle, and not a tessellation of one either. Returning the exact shape is what lets a moved symbol keep an exact test, where mapping a fixed vertex list forward would bake in whatever approximation the vertices already carried.

      An implementation must carry frameAngle forward too, adding the matrix's own rotation to it — Geometry2d.rotatedFrameAngle does that. Dropping it silently widens the shape's box the first time anything turns it.

      Parameters

      Returns PointSet2d

    frameAngle: number
    isClosed: boolean
    isFilled: boolean
    padding: number
    points: TPoint[]

    Read directly rather than through Geometry2d.vertices by subclasses on a hot path: the getter memoizes, so both give the same array, but hit-testing calls this once per sample.