Variable: Geometry
@kortexya/reasoninglayer / Geometry
Variable: Geometry
Section titled “Variable: Geometry”
constGeometry:object
Defined in: src/builders/value.ts:478
Builder namespace for the geometric shapes carried by Value.geometry.
Produces JSON using the "kind" discriminator (NOT "type"):
{"kind": "Point2D", "x": 3, "y": 4}.
Type Declaration
Section titled “Type Declaration”boundingBox()
Section titled “boundingBox()”
readonlyboundingBox(x,y,width,height):BoundingBoxGeometry
Create an axis-aligned bounding box.
Parameters
Section titled “Parameters”number
Left edge.
number
Top edge — the origin is top-left, as in image coordinates.
number
Width.
height
Section titled “height”number
Height.
Returns
Section titled “Returns”A BoundingBoxGeometry.
Remarks
Section titled “Remarks”Serialization format: Tagged by "kind" (GeometryDto).
Example
Section titled “Example”Geometry.boundingBox(10, 20, 100, 50)circle()
Section titled “circle()”
readonlycircle(centerX,centerY,radius):CircleGeometry
Create a circle.
Parameters
Section titled “Parameters”centerX
Section titled “centerX”number
Centre, horizontal.
centerY
Section titled “centerY”number
Centre, vertical.
radius
Section titled “radius”number
Radius.
Returns
Section titled “Returns”A CircleGeometry.
Remarks
Section titled “Remarks”Serialization format: Tagged by "kind" (GeometryDto).
Example
Section titled “Example”Geometry.circle(50, 50, 12.5)point()
Section titled “point()”
readonlypoint(x,y):Point2DGeometry
Create a point in the plane.
Parameters
Section titled “Parameters”number
Horizontal coordinate.
number
Vertical coordinate.
Returns
Section titled “Returns”A Point2DGeometry: {"kind": "Point2D", "x": 3, "y": 4}.
Remarks
Section titled “Remarks”Serialization format: Tagged by "kind" (GeometryDto).
Example
Section titled “Example”Geometry.point(3, 4)polygon()
Section titled “polygon()”
readonlypolygon(points):PolygonGeometry
Create a polygon from an ordered ring of vertices.
Parameters
Section titled “Parameters”points
Section titled “points”[number, number][]
The vertices, each an [x, y] pair.
Returns
Section titled “Returns”A PolygonGeometry.
Throws
Section titled “Throws”If a vertex is not a pair of numbers.
Remarks
Section titled “Remarks”Serialization format: Tagged by "kind" (GeometryDto).
The ring is implicitly closed — do not repeat the first vertex last.
Example
Section titled “Example”Geometry.polygon([[0, 0], [10, 0], [10, 8], [0, 8]])Remarks
Section titled “Remarks”Discriminator field is "kind", NOT "type" — the same convention as
FuzzyShape, and for the same reason: type is taken by the
enclosing tagged value.
Example
Section titled “Example”import { Geometry, Value } from '@kortexya/reasoninglayer';
const footprint = Value.geometry(Geometry.polygon([[0, 0], [10, 0], [10, 8], [0, 8]]));