Skip to main content

Path

A class in Root.Township, Alta.Forests.

One direction of an Edge in the forest generator's node graph, with links to the spaces on either side and the next paths around each node. Used during forest generation.

Constructors​

MemberWhat it is
Path(Edge edge, bool isA)Creates a Path from edge and isA.

Properties​

MemberWhat it is
Path AntiClockwise { get; internal set; }The next path anticlockwise around the graph, set by the generator.
Path Clockwise { get; internal set; }The next path clockwise around the graph, set by the generator.
Edge Edge { get; }The undirected edge this path is one direction of.
bool IsAB { get; }True when this path runs from the edge's A node to its B node.
Space Left { get; internal set; }The space on this path's left, set by the generator.
Path Reverse { get; }The same edge in the other direction.
Space Right { get; internal set; }The space on this path's right, set by the generator.

Methods​

MemberWhat it is
void GetAdjacent(out Path fromCC, out Path fromC, out Path toCC, out Path toC)Finds the nearest neighbouring paths on each side at both the start and end nodes.
void GetSides(float additionalRadius, out float startLeft, out float endLeft, out float startRight, out float endRight)Works out where along the path (0 to 1) each side clears the node radii plus extra radius, using the adjacent paths' angles.
float InsideDot(Path path, Vector2 position, out float angleDot)For a path sharing a node, dot between the corner's bisector and the direction to a position. Also outputs the corner's dot.
bool IsInside(Path path, Vector2 position, out float angleDot)Whether a position lies inside the corner this path forms with another path that shares a node.
Vector3 Lerp3d(float t)Point along the path in 3D, from start (0) to end (1).
void ProgressFromAngle(Path path, ref float thisProgress, ref float pathProgress)Flips the two progress values so both measure from the shared node of the corner.
2 private and internal methods
MemberWhat it is
private float InsideDot(Vector2 origin, Vector2 arm1, Vector2 arm2, Vector2 position, out float armsDot)For a path sharing a node, dot between the corner's bisector and the direction to a position. Also outputs the corner's dot.
private bool IsWithin(Vector2 origin, Vector2 arm1, Vector2 arm2, Vector2 position, out float armsDot)True if a point lies inside the angle between two arms from an origin. Also returns the arms' dot product.

Used in​

Members of other types that take, return or hold a Path: