API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

I

interfaceShapeLike

@codexo/exojs / math / stable

Conformance contract shared by the concrete math shape values (Circle, Rectangle, Polygon, Ellipse, Line, Vector): a Collidable that can also be cloned, destroyed and queried for its axis-aligned bounding box. Two implementers (Vector, Line) satisfy Collidable structurally but produce no SAT collision response, so an API that needs a resolvable overlap should take Collidable and check the response it gets back rather than accepting any `ShapeLike`.

1
props
9
methods
0
events
Import
import { ShapeLike } from '@codexo/exojs'

Conformance contract shared by the concrete math shape values (Circle, Rectangle, Polygon, Ellipse, Line, Vector): a Collidable that can also be cloned, destroyed and queried for its axis-aligned bounding box.

Two implementers (Vector, Line) satisfy Collidable structurally but produce no SAT collision response, so an API that needs a resolvable overlap should take Collidable and check the response it gets back rather than accepting any `ShapeLike`.

Methods9
clone(): ShapeLike
Compute a full CollisionResponse between this shape and target. Returns null in two cases: - the shapes do not overlap, **or** - the specific shape-pair combination does not support response generation (e.g. Line against any shape, Ellipse against Ellipse or Polygon). Use intersectsWith for a universal boolean overlap check that works across all supported shape pairs.
contains(x: number, y: number): boolean
Returns true if the point (x, y) is inside this shape.
copy(source: ShapeLike): this
destroy(): void
The axis-aligned bounding box of this object. Pass out to write into a rectangle you own - every implementer honours it, so this form is always safe to retain and never allocates. Without out, the math shape values (Rectangle, Circle, Polygon, ...) return a **fresh** rectangle, while a node or view that maintains a cached box (see SceneNode.getBounds) returns that cached instance, which the next invalidation overwrites.
Return the outward-facing edge normals used by the SAT solver. The array should be cached and reused across calls.
Test whether this shape overlaps target using a fast boolean algorithm (no penetration depth or normal computed). Prefer this over collidesWith when only the yes/no result is needed.
Properties1
Source