geom

GeomPolylinePathGeom.PolylinePath

Inherits: RefCounted

A list of points for GeomDraw.polyline() and polyline_2d(), each with its own color and thickness.

Point color and thickness multiply the draw state's, so a path can taper or carry a gradient. For a path at one color and thickness, GeomDraw.polyline_points() takes an array directly.

Drawing it

The code used to generate this page's thumbnail.

var path := GeomPolylinePath.new()
GeomDraw.polyline_join = Geom.JOIN_ROUND
GeomDraw.thickness = vp.y * 0.085
GeomDraw.color = PINK
for i in 25:
	var u := i / 24.0
	path.add_point_2d(c + Vector2(-r * 1.15 + u * r * 2.3, -sin(u * TAU) * r * 0.62))
GeomDraw.polyline_2d(path, false)
var path = Geom.PolylinePath.New();
Geom.Draw.PolylineJoin = Geom.PolylineJoin.Round;
Geom.Draw.Thickness = vp.Y * 0.085f;
Geom.Draw.Color = PINK;
for (int i = 0; i < 25; i++)
{
	var u = i / 24.0f;
	path.AddPoint2D(c + new Vector2(-r * 1.15f + u * r * 2.3f, -Mathf.Sin(u * Mathf.Tau) * r * 0.62f));
}
Geom.Draw.Polyline2D(path, false);

Methods

voidvoid add_point(position: Vector3)AddPoint(Vector3 position)
voidvoid add_point_2d(position: Vector2)AddPoint2D(Vector2 position)
voidvoid add_point_2d_colored(position: Vector2, color: Color)AddPoint2DColored(Vector2 position, Color color)
voidvoid add_point_2d_full(position: Vector2, color: Color, thickness_scale: float)AddPoint2DFull(Vector2 position, Color color, float thicknessScale)
voidvoid add_point_colored(position: Vector3, color: Color)AddPointColored(Vector3 position, Color color)
voidvoid add_point_full(position: Vector3, color: Color, thickness_scale: float)AddPointFull(Vector3 position, Color color, float thicknessScale)
voidvoid clear()Clear()
intint point_count()PointCount()

Method descriptions

voidvoid add_point(position: Vector3)AddPoint(Vector3 position)

Appends a 3D point at the draw state's color and thickness.

voidvoid add_point_2d(position: Vector2)AddPoint2D(Vector2 position)

Appends a 2D point at the draw state's color and thickness.

voidvoid add_point_2d_colored(position: Vector2, color: Color)AddPoint2DColored(Vector2 position, Color color)

Appends a 2D point with its own color.

voidvoid add_point_2d_full(position: Vector2, color: Color, thickness_scale: float)AddPoint2DFull(Vector2 position, Color color, float thicknessScale)

Appends a 2D point with its own color and thickness multiplier.

voidvoid add_point_colored(position: Vector3, color: Color)AddPointColored(Vector3 position, Color color)

Appends a 3D point with its own color.

voidvoid add_point_full(position: Vector3, color: Color, thickness_scale: float)AddPointFull(Vector3 position, Color color, float thicknessScale)

Appends a 3D point with its own color and thickness multiplier.

voidvoid clear()Clear()

Removes every point.

intint point_count()PointCount()

How many points the path holds.