12.3.34. Segment

A segment between 2 points

12.3.34.1. Attributes

  • p1: point 1.
  • p2: point 2.
  • length: the length of the segment.
  • angle: the angle of the segment.
  • midpoint: the midpoint of the segment.

In addition, all the attributes of shape

12.3.34.2. Methods

  • point(x): returns a point along the segment. X can be a number between 0 and length or a percentage.

12.3.34.3. Examples

segment s: .from (0,0) : .to (20, 20)
p = s.point 50%:  # returns the midpoint