Skip to content
Symi Docs
WASM / JavaScript

Signatures in the WASM / JavaScript view are TypeScript. Where the JavaScript facade wraps an operation its form is listed first; the other calling forms are the raw wasm-bindgen exports.

On this page

Geometry

Exact symbolic plane geometry. Coordinates, lengths, and angles are Expression values.

Constructors#

Constructing a geometry class directly uses the shared default context. The matching Context method constructs the object in an explicit context.

point_2d#

Not exposed by the WASM / JavaScript bindings. Available as Context.point_2d in Python, UniffiSession.point2d in Kotlin, UniffiSession.point2d in Swift, api::Session::point_2d in Rust.

segment_2d#

Not exposed by the WASM / JavaScript bindings. Available as Context.segment_2d in Python, UniffiSession.segment2d in Kotlin, UniffiSession.segment2d in Swift, api::Session::segment_2d in Rust.

polygon_2d#

Not exposed by the WASM / JavaScript bindings. Available as Context.polygon_2d in Python, UniffiSession.polygon2d in Kotlin, UniffiSession.polygon2d in Swift, api::Session::polygon_2d in Rust.

Simple polygon from its vertex list in order; degenerate inputs raise.

triangle_2d#

Not exposed by the WASM / JavaScript bindings. Available as Context.triangle_2d in Python, UniffiSession.triangle2d in Kotlin, UniffiSession.triangle2d in Swift, api::Session::triangle_2d in Rust.

Collinear vertices raise.

circle_2d#

Not exposed by the WASM / JavaScript bindings. Available as Context.circle_2d in Python, UniffiSession.circle2d in Kotlin, UniffiSession.circle2d in Swift, api::Session::circle_2d in Rust.

point_2d methods#

x#

Raw WebAssembly: Point2d property

readonly x: Expression

The x coordinate of the point.

y#

Raw WebAssembly: Point2d property

readonly y: Expression

The y coordinate of the point.

coordinates#

Raw WebAssembly: Point2d method

coordinates(): Expression[]

The (x, y) coordinate pair of the point.

distance_to#

Not exposed by the WASM / JavaScript bindings. Available as Point2d.distance_to in Python, UniffiPoint2d.distanceTo in Kotlin, UniffiPoint2d.distanceTo in Swift, api::Point2d::distance_to in Rust.

Euclidean distance, exact (a sqrt expression in general).

segment_2d methods#

length#

Also the finite-set length accessor on Expression in WASM; context disambiguates.

Raw WebAssembly: Segment2d method

length(): Expression

Length of the segment.

midpoint#

Raw WebAssembly: Segment2d method

midpoint(): Point2d

Midpoint of the segment.

perpendicular_bisector_equation#

Not exposed by the WASM / JavaScript bindings. Available as Segment2d.perpendicular_bisector_equation in Python, UniffiSegment2d.perpendicularBisectorEquation in Kotlin, UniffiSegment2d.perpendicularBisectorEquation in Swift, api::geometry_operations::Segment2d::perpendicular_bisector_equation in Rust.

The bisector line as an equal relation in x and y.

polygon_2d and triangle_2d#

area#

Raw WebAssembly: Polygon2d method

area(): Expression
Calling forms and variants

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.area

area(): Expression

For a Polygon2d or Triangle2d, this is the unsigned shoelace area of the ordered boundary, so a polygon's orientation does not change its area. A circle's area is a different formula under a different owner; see Circle2d.area.

perimeter#

Raw WebAssembly: Polygon2d method

perimeter(): Expression
Calling forms and variants

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.perimeter

perimeter(): Expression

centroid#

Raw WebAssembly: Polygon2d method

centroid(): Point2d
Calling forms and variants

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.centroid

centroid(): Point2d

interior_angles#

Raw WebAssembly: Polygon2d method

interiorAngles(): VertexAngle[]
Calling forms and variants

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.interiorAngles

interiorAngles(): VertexAngle[]

Each vertex paired with its interior angle. Notes: WASM returns VertexAngle objects with vertex/angle getters.

vertex_angle (WASM result class)#

vertex#

Raw WebAssembly: VertexAngle property

readonly vertex: Point2d

The vertex the angle is measured at.

angle#

Raw WebAssembly: VertexAngle property

readonly angle: Expression

The interior angle at the vertex.

circle_2d methods#

center#

Raw WebAssembly: Circle2d property

readonly center: Point2d

The center of the circle.

radius#

Raw WebAssembly: Circle2d property

readonly radius: Expression

The radius of the circle.

Circle2d.area#

Raw WebAssembly: Circle2d method

area(): Expression

The exact disk area πr2\pi r^2, from the circle's symbolic radius. This is not the polygon and triangle shoelace operation of area above; the two share a member name and nothing else.

circumference#

Raw WebAssembly: Circle2d method

circumference(): Expression

Circumference of the circle.

equation#

Raw WebAssembly: Circle2d method

equation(variable_x: string, variable_y: string): Expression

The circle as an equal relation in x and y.

Exact boundary intersections#

intersection#

Raw WebAssembly: Point2d method

intersection(other: any): any[]
Calling forms and variants

Variant for this object — Raw WebAssembly: Circle2d method: Circle2d.intersection

intersection(other: any): any[]

Variant for this object — Raw WebAssembly: Polygon2d method: Polygon2d.intersection

intersection(other: any): any[]

Variant for this object — Raw WebAssembly: Segment2d method: Segment2d.intersection

intersection(other: any): any[]

Variant for this object — Raw WebAssembly: Triangle2d method: Triangle2d.intersection

intersection(other: any): any[]

Every point, segment, polygon, triangle, and circle exposes the same symmetric intersection method. Polygon and triangle operands mean their closed boundary; circle operands mean their circumference. Isolated intersections are returned as Point2d objects, while a shared edge or coincident circle is returned as the corresponding Segment2d or Circle2d component instead of sampled points. The component sequence is exact and deterministic. If any required symbolic predicate cannot be decided, the operation declines instead of returning an incomplete list. Both operands must belong to the same context.

Output#

All geometry classes also provide to_latex (and serialize_object in WASM; Python serializes through Context.serializeObject).

Example#

This family is not part of the recommended JavaScript facade in this release. Call it through the generated symi.raw layer, whose entries are listed with their wasm-bindgen signatures above, and read Migration for the ownership rules that apply there.

Additional API#

circle2d#

Raw WebAssembly: Explicit context

circle2d(center: Point2d, radius: Expression): Circle2d

Construct the circle with the given center and radius.

point2d#

Raw WebAssembly: Explicit context

point2d(x: Expression, y: Expression): Point2d

Construct the point (x, y).

polygon2d#

Raw WebAssembly: Explicit context

polygon2d(vertices: Point2d[]): Polygon2d

Simple polygon from its vertex list in order; degenerate inputs raise.

segment2d#

Raw WebAssembly: Explicit context

segment2d(start: Point2d, end: Point2d): Segment2d

Construct the segment running from start to end.

triangle2d#

Raw WebAssembly: Explicit context

triangle2d(
    point_a: Point2d,
    point_b: Point2d,
    point_c: Point2d,
): Triangle2d

Collinear vertices raise.

Circle2d#

Raw WebAssembly: Circle2d constructor

new Circle2d(center: Point2d, radius: Expression)

Construct the circle with the given center and radius.

Circle2d.toString#

Raw WebAssembly: Circle2d method

toString(): string

The mathematical text of this object, as a JavaScript string.

Point2d#

Raw WebAssembly: Point2d constructor

new Point2d(x: Expression, y: Expression)

Construct the point (x, y).

Point2d.distanceTo#

Raw WebAssembly: Point2d method

distanceTo(other: Point2d): Expression

Euclidean distance, exact (a sqrt expression in general).

Point2d.toString#

Raw WebAssembly: Point2d method

toString(): string

The mathematical text of this object, as a JavaScript string.

Polygon2d#

Raw WebAssembly: Polygon2d constructor

new Polygon2d(vertices: Point2d[])

Construct the polygon with the given vertices, in order.

Polygon2d.toString#

Raw WebAssembly: Polygon2d method

toString(): string

The mathematical text of this object, as a JavaScript string.

Segment2d#

Raw WebAssembly: Segment2d constructor

new Segment2d(start: Point2d, end: Point2d)

Construct the segment running from start to end.

Segment2d.perpendicularBisectorEquation#

Raw WebAssembly: Segment2d method

perpendicularBisectorEquation(
    variable_x: string,
    variable_y: string,
): Expression

The bisector line as an equal relation in x and y.

Segment2d.toString#

Raw WebAssembly: Segment2d method

toString(): string

The mathematical text of this object, as a JavaScript string.

Triangle2d#

Raw WebAssembly: Triangle2d constructor

new Triangle2d(point_a: Point2d, point_b: Point2d, point_c: Point2d)

Construct the triangle with the given vertices.

Triangle2d.toString#

Raw WebAssembly: Triangle2d method

toString(): string

The mathematical text of this object, as a JavaScript string.

Symi documentation · WASM / JavaScript