Functions

Here are listed all of GeoScript's functions. Note that, the names are case-insensitive and ignore underscores. This means that functions perpendicular_through, perpendicularthrough, PERPendicularthrougH and P_erpendic_ular___Through_ are the same function. Overloads are listed in the order they are checked.

acos

  • acos(v: Number (no unit))

Return type: Number (angle)

Returns: Arccosine of this value.

acot (alias actg)

  • acot(v: Number (no unit))

Return type: Number (angle)

Returns: Arccotangent of this value.

acsc

  • acsc(v: Number (no unit))

Return type: Number (angle)

Returns: Arccosecant of this value.

angle

  • angle(ABC: 3-P)
  • angle(A: Point, B: Point, C: Point)

Return type: Number (angle)

Returns: measurement of the angle ABC

Displays: the angle's arms.

The function accepts additional properties in the form of:

#![allow(unused)]
fn main() {
struct Angle {
    display_arms: bool, // Default: true,
    arms_type: LineType, // Default: SEGMENT
}
}

display_arms decides whether the arms should be displayed and arms_type decides whether they should be segments, rays or lines. The assumed order for rays is B -> A and B -> C;

  • angle(k: Line, l: Line)

Return type: Number (angle)

Returns: measurement of the angle between k and l. Which angle, depends on the order of the lines. For predictable outcome, the point versions are strongly recommended.

area

  • area(A (Point), B (Point), C (Point), ...)
  • area(ABC... (Point collection))

Works for 3 or more points.

Return type: Number (distance^2)

Returns: the area of the given polygon.

asec

  • asec(v: Number (no unit))

Return type: Number (angle)

Returns: Arcsecant of this value.

asin

  • asin(v: Number (no unit))

Return type: Number (angle)

Returns: Arcsine of this value.

atan (alias atg)

  • atan(v: Number (no unit))

Return type: Number (angle)

Returns: Arctangent of this value.

bisector

  • bisector(AB: 2-P)
  • bisector(A: Point, B: Point)

Return type: Line

Returns: a bisector of the segment AB - a perpendicular line passing through its center.

  • bisector(ABC: 3-P)
  • bisector(A: Point, B: Point, C: Point)

Return type: Line

Returns: a bisector of the angle ABC - a line between lines AB and BC, where each point is in the same distance from both of these lines.

Displays: the angle's arms.

The function accepts additional properties in the form of:

#![allow(unused)]
fn main() {
struct Bisector {
    display_arms: bool, // Default: true,
    arms_type: LineType, // Default: SEGMENT
}
}

display_arms decides whether the arms should be displayed and arms_type decides whether they should be segments, rays or lines. The assumed order for rays is B -> A and B -> C;

  • angle(k: Line, l: Line)

center

  • center(circle: Circle)

**Return type: Point

circle

  • circle(center: Point, radius: Number (distance))
  • circle(radius: Number (distance), center: Point)

Return type: Circle

Returns: a circle with the given center and radius.

  • circle()

Return type: Circle

Returns: a circle with an adjusted (free point) center and an adjusted (free real) radius.

circumcircle

  • circumcircle(a: Point, b: Point, c: Point)
  • circumcircle(abc: 3-P)

Return type: Circle

Returns: a circle circumscribed on the three points given.

conjugate

  • conjugate(v: Number (any unit))

Return type: Number (the same unit)

Returns: The conjugate of this number.

convex (alias convexpolygon, convexpoly)

  • convex(n: Number (literal, no unit))

Only works with a number literal.

Return type: PC-n

Returns: A convex polygon with n sides.

cos

  • cos(v: Number (angle))

Return type: Number (no unit)

Returns: Cosine of this angle.

cot (alias ctg)

  • cot(v: Number (angle))

Return type: Number (no unit)

Returns: Cotangent of this angle.

csc

  • csc(v: Number (angle))

Return type: Number (no unit)

Returns: Cosecant of this angle.

degrees (alias deg)

  • degrees(value: Number (no unit))

Return type: Number (angle)

Returns: an angle with the given measurement in degrees. Related: radians

  • degrees(value: Number (angle))

Return type: Number (no unit)

Returns: the angle value in degrees. Related: radians

dst (alias len)

  • dst(AB: 2-P)
  • dst(A: Point, B: Point)

Return type: Number (distance)

Returns: the distance between points A and B.

Displays: the segment AB.

The function accepts additional properties in the form of:

#![allow(unused)]
fn main() {
struct Dst {
    display_segment: bool, // Default: true,
    style: Style, // Default: SOLID
}
}

display_segment decides whether the segment should be displayed and style decides how it should be displayed.

  • dst(P: Point, k: Line)
  • dst(k: Line, P: Point)

Return type: Number (distance)

Returns: the distance between point P and line k.

Displays: the segment between P and its perpendicular projection onto k.

The function accepts additional properties in the form of:

#![allow(unused)]
fn main() {
struct Dst {
    display_segment: bool, // Default: true,
    style: Style, // Default: DASHED
}
}

display_segment decides whether the segment should be displayed and style decides how it should be displayed.

  • dst(value: Number (no unit / distance))

Return type: Number (angle)

Returns: the value with a distance unit.

homothety

  • homothety(origin: Point, scale: Number (no unit))
  • homothety(scale: Number (no unit), origin: Point)

Return type: TransformType

Returns: a homothety with an origin and scale.

imaginary (alias im)

  • imaginary(v: Number (any unit))

Return type: Number (the same unit)

Returns: The imaginary part of this number.

incircle

  • incircle(a: Point, b: Point, c: Point)
  • incircle(abc: 3-P)

Return type: Circle

Returns: a circle inscribed in the three points given.

intersection

All overloads by default don't display the point dot. This can be changed with properties.

  • intersection(k: Line, l: Line)

Return type: Point

Returns: intersection of lines k and l.

  • intersection(k: Line, circle: Circle)
  • intersection(circle: Circle, k: Line)

Return type: Point

Returns: intersection of line k and circle circle.

  • intersection(o1: Circle, o2: Circle)

Return type: Point

Returns: intersection of circles o1 and o2.

Note: display_dot property is not currently supported.

line

  • line(col: 2-PC)
  • line(P: Point, Q: Point)

Return type: Line

Returns: a line through two given points.

Displays: The created line.

mid

  • mid(col: 0-P)

Return Type: Point

Returns: The middle point of all points in the collection.

Note: The following functions allow any positive numbers of arguments.

  • mid(v_1: Number (any unit u), v_2 Number (the same unit u), ..., v_n: Number (the same unit u))

Return type: Number (the same unit u)

Returns: The average value of v_1, v_2, ... v_n.

  • mid(P_1: Point, P_2: Point, ..., P_n: Point)

Return type: Point

Returns: The middle point of P_1, P_2, ... P_n. Special cases: when n=2, the middle of a segment; When n=3, the centroid of a triangle.

parallel_through (alias parallel)

  • parallel_through(P: Point, k: Line)
  • parallel_through(k: Line, P: Point)

Return type: Line

Returns: a line parallel to k, passing through P.

perpendicular_through (alias perpendicular)

  • perpendicular_through(P: Point, k: Line)
  • perpendicular_through(k: Line, P: Point)

Return type: Line

Returns: a line perpendicular to k, passing through P.

point

  • point()

Return type: Point

Returns: an adjusted (free) point.

polygon (alias poly)

  • polygon(n: Number (literal, no unit))

Only works with a number literal.

Return type: PC-n

Returns: A polygon with n sides. Possibly concave, possibly self-intersecting.

radians (alias rad)

  • radians(value: Number (no unit))

Return type: Number (angle)

Returns: an angle with the given measurement in radians. Related: degrees

  • radians(value: Number (angle))

Return type: Number (no unit)

Returns: the value of the angle in radians. Related: degrees

radius

  • radius(circle: Circle)

Return type: Number (distance)

Returns: the radius of the given circle.

real (alias re)

  • real(v: Number (any unit))

Return type: Number (the same unit)

Returns: The real part of this number.

  • real()

Return type: Number (no unit)

Returns: A free, adjustable real number.

reflect (alias reflection)

  • reflect(line: Line)

Return type: TransformType

Returns: A reflection about a line.

rotate (alias rotation)

  • rotate(origin: Point, angle: Number (angle), scale: Number (unitless))
  • rotate(origin: Point, scale: Number (unitless), angle: Number (angle))
  • rotate(angle: Number (angle), origin: Point, scale: Number (unitless))
  • rotate(angle: Number (angle), scale: Number (unitless), origin: Point)
  • rotate(scale: Number (unitless), origin: Point, angle: Number (angle))
  • rotate(scale: Number (unitless), angle: Number (angle), origin: Point)
  • rotate(angle: Number (angle), origin: Point)
  • rotate(origin: Point, angle: Number (angle))

Return type: TransformType

Returns: A rotation around an origin by an angle (possibly negative), along with an optional homothety at the same point.

sec

  • sec(v: Number (angle))

Return type: Number (no unit)

Returns: Secant of this angle.

segment

  • segment(AB: 2-P)
  • segment(A: Point, B: Point)

Return type: Segment

Returns: the segment AB.

Displays: the segment AB.

The function accepts additional properties in the form of:

#![allow(unused)]
fn main() {
struct Segment {
    display_segment: bool, // Default: true,
    style: Style, // Default: SOLID
}
}

display_segment decides whether the segment should be displayed and style decides how it should be displayed.

signedarea

  • signedarea(A (Point), B (Point), C (Point), ...)
  • signedarea(ABC... (Point collection))

Works for 3 or more points.

Return type: Number (distance^2)

Returns: the signed area of the given polygon.

sin

  • sin(v: Number (angle))

Return type: Number (no unit)

Returns: Sine of this angle.

tan (alias tg)

  • tan(v: Number (angle))

Return type: Number (no unit)

Returns: Tangent of this angle.

to_complex

  • to_complex(A: Point)

Return type: Number (distance)

Returns: the point as a complex number.

to_point

  • to_point(v: Number (distance))

Return type: Point

Returns: the complex number as a point.

transform

  • transform(t: TransformType, object: Any)

Return type: Depends on the transformationi and input.

Returns: The object transformed using the transformation. Is type isn't supported, a compile error will be raised.

translate (alias translation)

  • translate(vector: Distance)

Return type: TransformType

Returns: A translation by a vector.

x

  • x(P: Point)

Return type: Number (distance)

Returns: The x coordinate of the point.

y

  • y(P: Point)

Return type: Number (distance)

Returns: The y coordinate of the point.