Path2d

class Path2d(val points: List<Vector2>, val closed: Boolean)

A set of points most commonly used by Shape2d. When a Shape2d is rendered, the path is assumed to be closed, despite the closed boolean. Therefore, the closed property is only used for such things as extruding a profile along a path.

Paths may self intersect, but such paths should NOT be used to form a Polygon.

Within FooCAD, the direction of the points matters. By convention, holes are ordered clockwise, and non-holes anticlockwise. This is only important when paths are used to create a Polygon. OpenSCAD has no such restriction.

Constructors

Link copied to clipboard
constructor(vararg points: Vector2)
constructor(points: List<Vector2>, closed: Boolean)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun center(): Path2d
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun contains(point: Vector2): Boolean

Determines if point is contained within this path. The path is assumed to be closed.

Link copied to clipboard

If this path's points are ordered clockwise, then return this path, otherwise return the reverse of this path.

Link copied to clipboard

If this path's points are ordered clockwise, then return a reverse of this path. Otherwise, return this path.

Link copied to clipboard
fun flipXY(): Path2d
Link copied to clipboard
Link copied to clipboard
operator fun get(i: Int): Vector2

Allows array-like access to the points where the index is rolled around, so that index -1 is the same as size-1 and also index size is the same as index 0 etc.

Link copied to clipboard

Are the points listed in a clockwise direction. For most paths, they should be clockwise. The only exception is when the path is being used to define a hole.

Link copied to clipboard

As holes should be ordered clockwise, this is synonymous with isClockwise.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun offset(delta: Double): Path2d?
fun offset(delta: Double, chamfer: Boolean): Path2d?
Link copied to clipboard

Creates a duplicate of this path with any consecutive duplicated points removed.

Link copied to clipboard

Return a new path, with the points in the opposite order. This will change the path from being a hole to a non-hole or vice versa.

Link copied to clipboard
Link copied to clipboard
fun rotate(degrees: Double): Path2d
Link copied to clipboard
fun rotateAbout(angle: Double, about: Vector2): Path2d
Link copied to clipboard
fun scale(by: Vector2): Path2d
Link copied to clipboard
fun scaleX(by: Double): Path2d
Link copied to clipboard
fun scaleY(by: Double): Path2d
Link copied to clipboard
fun thickness(width: Double): Polygon
fun thickness(width: Double, chamfer: Boolean, roundCap: Boolean): Polygon
fun thickness(width: Double, chamfer: Boolean, roundCap: Boolean, convexity: Int?): Polygon
Link copied to clipboard
operator fun times(matrix: Matrix2d): Path2d

This is an operator version of transform. e.g.

Link copied to clipboard
fun to3d(): Path3d

Creates a Path3d. All Z values are zero.

Link copied to clipboard
fun Path2d.toJTSLineString(): LineString

Converts a FooCAD Path2d into a jts LineString. If the Path2d is closed, then use Path2d.toJTSPolygon instead.

Link copied to clipboard
fun Path2d.toJTSPolygon(): Polygon

Convert a FooCAD Path2d into a jts Polygon. If the Path2d is not closed, then use Path2d.toJTSLineString instead.

Link copied to clipboard
Link copied to clipboard

Creates a 3d path from this 2d path, with all Z values set to zero.

Link copied to clipboard
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun transform(matrix: Matrix2d): Path2d

Returns a new path, where each point is transformed by the matrix.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard