Перейти до основного вмісту

raygeo.sketch.constraints.symmetry

SymmetryConstraint​

Enforces two points are symmetric about a point or a line.

p1​

p1: int

First point.

p2​

p2: int

Second point.

target​

target: SymmetryTarget

Symmetry reference.

error()​

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

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

ParameterTypeDescription
registryregistry.EntityRegistry
Returnslist[float]

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_user_visible()​

set_user_visible(value: bool) -> None

Sets the reference user-visibility flag.

ParameterTypeDescription
valuebool
ReturnsNone

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

SymmetryTarget​

The symmetry reference: point symmetry about a center, or line symmetry about an axis line.

Line​

p1 and p2 are mirrored across the line (l1, l2).

Point​

The center is the midpoint of p1 and p2.