interface RVG · Factories

RvgShapeFactory

interface RvgShapeFactory

Creates shapes of a group that are not drawn: the input of computations, or points and outlines to compute with.

Reach it through shapes of a group. A shape made here holds the points it gets, as described on Shape; for a shape that is drawn, use visuals of the group. Without points, the shape's points are at (0, 0) (polygon() has none, polygon(size) has size).

Methods

arc

arc(): Arc

Creates a circular arc with 3 points initialized at the origin.

Returns An arc instance.

arc(start: Point | VectorLike, middle: Point | VectorLike, end: Point | VectorLike): Arc

Creates a circular arc passing through exactly 3 specified points.

start
The start point of the arc.
middle
The middle point on the arc.
end
The end point of the arc.

Returns An arc instance.

box

box(): Box

Creates a box initialized at the origin.

Returns A box instance.

box(p1: Point | VectorLike, p2: Point | VectorLike): Box

Creates a box spanned by two points.

p1
The first corner.
p2
The opposite corner.

Returns A box instance.

circle

circle(): Circle

Creates a circle with 3 points initialized at the origin.

Returns A circle instance.

circle(p1: Point | VectorLike, p2: Point | VectorLike, p3: Point | VectorLike): Circle

Creates a circle passing through exactly 3 specified points.

p1
The first point.
p2
The second point.
p3
The third point.

Returns A circle instance.

circleAt

circleAt(center: Point | VectorLike, radius: Real | NumberLike): Circle

Creates a circle at a specified center with a specified radius.

center
The center of the circle.
radius
The radius of the circle.

Returns A circle instance.

polygon

polygon(vertices: Sequence<Vector> | VectorsLike): Polygon

Creates a polygon from a collection of vertices.

vertices
The points defining the polygon.

Returns A polygon instance.

polygon(): Polygon

Creates an empty polygon.

Returns A polygon instance with no vertices.

polygon(size: number): Polygon

Creates a polygon with a specified number of vertices initialized at the origin.

size
The number of vertices.

Returns A polygon instance.

polygon3P

polygon3P(): Polygon

Creates a polygon with 3 vertices initialized at the origin.

Returns A polygon instance.

polygon3P(p1: Point | VectorLike, p2: Point | VectorLike, p3: Point | VectorLike): Polygon

Creates a polygon with exactly 3 specified points.

p1
The first vertex.
p2
The second vertex.
p3
The third vertex.

Returns A polygon instance.

polygon4P

polygon4P(): Polygon

Creates a polygon with 4 vertices initialized at the origin.

Returns A polygon instance.

polygon4P(p1: Point | VectorLike, p2: Point | VectorLike, p3: Point | VectorLike, p4: Point | VectorLike): Polygon

Creates a polygon with exactly 4 specified points.

p1
The first vertex.
p2
The second vertex.
p3
The third vertex.
p4
The fourth vertex.

Returns A polygon instance.

polyline

polyline(vertices: Sequence<Vector> | VectorsLike): Polyline

Creates a polyline from a collection of vertices.

vertices
The points defining the polyline.

Returns A polyline instance.

polyline(): Polyline

Creates an empty polyline.

Returns An empty polyline.

polyline(size: number): Polyline

Creates a polyline with a specified number of vertices initialized at the origin.

size
The number of vertices.

Returns A polyline instance.

polyline3P

polyline3P(): Polyline

Creates a polyline with 3 vertices initialized at the origin.

Returns A polyline instance.

polyline3P(p1: Point | VectorLike, p2: Point | VectorLike, p3: Point | VectorLike): Polyline

Creates a polyline with exactly 3 specified points.

p1
The first vertex.
p2
The second vertex.
p3
The third vertex.

Returns A polyline instance.

polyline4P

polyline4P(): Polyline

Creates a polyline with 4 vertices initialized at the origin.

Returns A polyline instance.

polyline4P(p1: Point | VectorLike, p2: Point | VectorLike, p3: Point | VectorLike, p4: Point | VectorLike): Polyline

Creates a polyline with exactly 4 specified points.

p1
The first vertex.
p2
The second vertex.
p3
The third vertex.
p4
The fourth vertex.

Returns A polyline instance.

rectangle

rectangle(): Rectangle

Creates a rectangle initialized at the origin.

Returns A rectangle instance.

rectangle(p1: Point | VectorLike, p2: Point | VectorLike, height: Real | NumberLike): Rectangle

Creates a rectangle defined by two points and a height.

p1
The first point defining the base of the rectangle.
p2
The second point defining the base of the rectangle.
height
The height of the rectangle perpendicular to the base.

Returns A rectangle instance.

segment

segment(): Segment

Creates a line segment initialized at the origin.

Returns A line segment instance.

segment(p1: Point | VectorLike, p2: Point | VectorLike): Segment

Creates a line segment between two specified points.

p1
The start point.
p2
The end point.

Returns A line segment instance.

triangle

triangle(): Triangle

Creates a triangle with 3 vertices initialized at the origin.

Returns A triangle instance.

triangle(p1: Point | VectorLike, p2: Point | VectorLike, p3: Point | VectorLike): Triangle

Creates a triangle with the specified vertices.

p1
The first vertex.
p2
The second vertex.
p3
The third vertex.

Returns A triangle instance.