Zum Hauptinhalt springen

raygeo.sketch.constraints.radius

RadiusConstraint​

Enforces the radius of a circle or arc.

center​

center: int

Center point of the circle/arc.

radius_point​

radius_point: int

Radius-bearing point (circle radius point or arc start).

value​

value: float

Resolved radius value.

constrains_radius()​

constrains_radius(registry: registry.EntityRegistry, entity_id: int) -> bool

Whether this constraint explicitly defines the radius of the given entity. The entity is matched through the registry by its defining points, mirroring the reference's stored entity id.

ParameterTypeDescription
registryregistry.EntityRegistry
entity_idint
Returnsbool

error()​

error(registry: registry.EntityRegistry) -> list[float]

Returns the constraint error at the registry's point positions.

ParameterTypeDescription
registryregistry.EntityRegistry
Returnslist[float]

expression()​

expression() -> Optional[str]

The stored expression string, if any (evaluated caller-side).

ParameterTypeDescription
ReturnsOptional[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).

ParameterTypeDescription
mxfloat
myfloat
thresholdfloat
registryregistry.EntityRegistry
to_screenOptional[Any] = None
Returnsbool

set_expression()​

set_expression(expression: Optional[str]) -> None

Sets the expression string (evaluated caller-side).

ParameterTypeDescription
expressionOptional[str]
ReturnsNone

set_user_visible()​

set_user_visible(value: bool) -> None

Sets the reference user-visibility flag.

ParameterTypeDescription
valuebool
ReturnsNone

targets_segment()​

targets_segment(
p1: int,
p2: int,
entity_id: Optional[int],
registry: registry.EntityRegistry,
) -> bool

Whether this constraint restricts the given entity. The entity is matched through the registry by its defining points, mirroring the reference's stored entity id.

ParameterTypeDescription
p1int
p2int
entity_idOptional[int]
registryregistry.EntityRegistry
Returnsbool

to_dict()​

to_dict() -> dict

Serializes to the reference constraint dictionary shape.

ParameterTypeDescription
Returnsdict

user_visible()​

user_visible() -> bool

Reference user-visibility flag.

ParameterTypeDescription
Returnsbool