raygeo.sketch.constraints.distance
DistanceConstraint
Enforces a fixed distance between two points.
p1
p1: int
First point.
p2
p2: int
Second point.
value
value: float
Resolved distance value.
constrains_radius()
constrains_radius(registry: registry.EntityRegistry, entity_id: int) -> bool
Whether this constraint explicitly defines the radius/length of the given entity.
| Parameter | Type | Description |
|---|---|---|
registry | registry.EntityRegistry | |
entity_id | int | |
| Returns | bool |
error()
error(registry: registry.EntityRegistry) -> list[float]
Returns the constraint error at the registry's point positions.
| Parameter | Type | Description |
|---|---|---|
registry | registry.EntityRegistry | |
| Returns | list[float] |
expression()
expression() -> Optional[str]
The stored expression string, if any (evaluated caller-side).
| Parameter | Type | Description |
|---|---|---|
| Returns | Optional[str] |
is_hit()
is_hit(
mx: float,
my: float,
threshold: float,
registry: registry.EntityRegistry,
to_screen: Optional[Any] = None,
) -> bool
Whether the constraint's rendered symbol is hit at (mx, my).
| Parameter | Type | Description |
|---|---|---|
mx | float | |
my | float | |
threshold | float | |
registry | registry.EntityRegistry | |
to_screen | Optional[Any] = None | |
| Returns | bool |
set_expression()
set_expression(expression: Optional[str]) -> None
Sets the expression string (evaluated caller-side).
| Parameter | Type | Description |
|---|---|---|
expression | Optional[str] | |
| Returns | None |
set_user_visible()
set_user_visible(value: bool) -> None
Sets the reference user-visibility flag.
| Parameter | Type | Description |
|---|---|---|
value | bool | |
| Returns | None |
targets_segment()
targets_segment(
p1: int,
p2: int,
entity_id: Optional[int],
registry: registry.EntityRegistry,
) -> bool
Whether this constraint defines the length/distance of the segment (p1, p2). The entity id is ignored: distance constraints track points only.
| Parameter | Type | Description |
|---|---|---|
p1 | int | |
p2 | int | |
entity_id | Optional[int] | |
registry | registry.EntityRegistry | |
| Returns | bool |
to_dict()
to_dict() -> dict
Serializes to the reference constraint dictionary shape.
| Parameter | Type | Description |
|---|---|---|
| Returns | dict |
user_visible()
user_visible() -> bool
Reference user-visibility flag.
| Parameter | Type | Description |
|---|---|---|
| Returns | bool |