Inversions¶
Circle inversion transformations.
Circle inversion is a transformation that maps points inside a circle to points outside (and vice versa). Points on the circle of inversion map to themselves.
API Reference¶
geolet.primitives.inversion.api.InvertPoint
¶
InvertPoint(point: PointT, *, respect_to: CircleT, label: str = '', label_dir: str = 'NE', color: str = 'black') -> InvertedPoint
Invert a point with respect to a circle.
Circle inversion is a transformation that maps points inside the circle to points outside (and vice versa), with the formula: P' = O + (r^2 / |P - O|^2) * (P - O)
Points on the circle map to themselves. The center of inversion maps to infinity (not representable).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
PointT
|
The point to invert. |
required |
respect_to
|
CircleT
|
The circle of inversion (CircleWithRadius with center and radius). |
required |
label
|
str
|
Display name for the inverted point. Omit for hidden. |
''
|
label_dir
|
str
|
Direction to place label relative to point. |
'NE'
|
color
|
str
|
Asymptote color name. |
'black'
|
Returns:
| Type | Description |
|---|---|
InvertedPoint
|
An inverted point drawable. |
Example
O = Point("O", 0, 0) c = CircleWithRadius(O, 2) P = Point("P", 1, 0) P_inv = InvertPoint(P, respect_to=c, label="P'") # Maps to (4, 0)
geolet.primitives.inversion.api.InvertLine
¶
InvertLine(line: LineT | SegmentT, *, respect_to: CircleT, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> CircleFromInvertedLine
Invert a line with respect to a circle.
Circle inversion of a line that does NOT pass through the center produces a circle passing through the center of inversion.
The returned object has a center_point() method to get a drawable center.
Note: This function handles the general case where the line does not pass through the center. For lines passing through the center of inversion (which map to themselves), use InvertLineThroughCenter instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
LineT | SegmentT
|
The line to invert (Line or Segment). Must not pass through the center of the inversion circle. |
required |
respect_to
|
CircleT
|
The circle of inversion (CircleWithRadius with center and radius). |
required |
label
|
str
|
Display label for the resulting circle (empty string for no label). |
''
|
label_dir
|
str
|
Direction for label placement (N, NE, E, SE, S, SW, W, NW). |
'N'
|
label_pos
|
float
|
Relative position along path for label (0.0 = start, 1.0 = end). |
0.0
|
color
|
str
|
Asymptote color name. |
'black'
|
style
|
str
|
Line style. One of: solid, dashed, dotted. |
'solid'
|
width
|
float
|
Line width in Asymptote units. |
1.0
|
Returns:
| Type | Description |
|---|---|
CircleFromInvertedLine
|
A CircleFromInvertedLine with a |
Example
O = Point("O", 0, 0) c = CircleWithRadius(O, 2) l = Line(Point("P", 1, -2), Point("Q", 1, 2)) # Vertical line x=1 inverted = InvertLine(l, respect_to=c) # Circle through O O_prime = inverted.center_point(label="O'", color="red")
geolet.primitives.inversion.api.InvertCircle
¶
InvertCircle(target: CircleT, *, respect_to: CircleT, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> InvertedCircle
Invert a circle with respect to another circle.
Circle inversion of a circle that does NOT pass through the center produces another circle.
Note: This function handles the general case where the target circle does not pass through the center of inversion. For circles passing through the center (which map to lines), use InvertCircleThroughCenter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
CircleT
|
The circle to invert (CircleWithRadius). Must not pass through the center of the inversion circle. |
required |
respect_to
|
CircleT
|
The circle of inversion (CircleWithRadius with center and radius). |
required |
label
|
str
|
Display label for the resulting circle (empty string for no label). |
''
|
label_dir
|
str
|
Direction for label placement (N, NE, E, SE, S, SW, W, NW). |
'N'
|
label_pos
|
float
|
Relative position along path for label (0.0 = start, 1.0 = end). |
0.0
|
color
|
str
|
Asymptote color name. |
'black'
|
style
|
str
|
Line style. One of: solid, dashed, dotted. |
'solid'
|
width
|
float
|
Line width in Asymptote units. |
1.0
|
Returns:
| Type | Description |
|---|---|
InvertedCircle
|
An inverted circle drawable. |
Example
O = Point("O", 0, 0) inv_circle = CircleWithRadius(O, 3) c = CircleWithRadius(Point("C", 2, 0), 1) c_inv = InvertCircle(c, respect_to=inv_circle) # Another circle
geolet.primitives.inversion.api.InvertLineThroughCenter
¶
InvertLineThroughCenter(line: LineT | SegmentT, *, respect_to: CircleT, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> InvertedLineThroughCenter
Invert a line that passes through the center of inversion.
A line through the center of inversion maps to itself under inversion. This function includes an Asymptote assertion that verifies the line actually passes through the center at render time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
LineT | SegmentT
|
The line to invert (Line or Segment). Must pass through the center of the inversion circle. |
required |
respect_to
|
CircleT
|
The circle of inversion (CircleWithRadius). |
required |
label
|
str
|
Display label for the line (empty string for no label). |
''
|
label_dir
|
str
|
Direction for label placement (N, NE, E, SE, S, SW, W, NW). |
'N'
|
label_pos
|
float
|
Relative position along path for label (0.0 = start, 1.0 = end). |
0.0
|
color
|
str
|
Asymptote color name. |
'black'
|
style
|
str
|
Line style. One of: solid, dashed, dotted. |
'solid'
|
width
|
float
|
Line width in Asymptote units. |
1.0
|
Returns:
| Type | Description |
|---|---|
InvertedLineThroughCenter
|
An inverted line drawable (same as original line). |
Example
O = Point("O", 0, 0) c = CircleWithRadius(O, 2) l = Line(Point("P", -1, 0), Point("Q", 1, 0)) # Line through O l_inv = InvertLineThroughCenter(l, respect_to=c) # Same line
geolet.primitives.inversion.api.InvertCircleThroughCenter
¶
InvertCircleThroughCenter(target: CircleT, *, respect_to: CircleT, label: str = '', label_dir: str = 'N', label_pos: float = 0.0, color: str = 'black', style: str = 'solid', width: float = 1.0) -> InvertedCircleThroughCenter
Invert a circle that passes through the center of inversion.
A circle through the center of inversion maps to a line under inversion. The resulting line is perpendicular to the line connecting the centers and passes through the inverted point opposite to the center.
This function includes an Asymptote assertion that verifies the circle actually passes through the center at render time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
CircleT
|
The circle to invert (CircleWithRadius). Must pass through the center of the inversion circle. |
required |
respect_to
|
CircleT
|
The circle of inversion (CircleWithRadius). |
required |
label
|
str
|
Display label for the resulting line (empty string for no label). |
''
|
label_dir
|
str
|
Direction for label placement (N, NE, E, SE, S, SW, W, NW). |
'N'
|
label_pos
|
float
|
Relative position along path for label (0.0 = start, 1.0 = end). |
0.0
|
color
|
str
|
Asymptote color name. |
'black'
|
style
|
str
|
Line style. One of: solid, dashed, dotted. |
'solid'
|
width
|
float
|
Line width in Asymptote units. |
1.0
|
Returns:
| Type | Description |
|---|---|
InvertedCircleThroughCenter
|
An inverted circle drawable (draws as a line). |
Example
O = Point("O", 0, 0) inv_circle = CircleWithRadius(O, 2)
Circle centered at (1, 0) with radius 1 passes through O¶
c = CircleWithRadius(Point("C", 1, 0), 1) c_inv = InvertCircleThroughCenter(c, respect_to=inv_circle)
Examples¶
Invert a Point¶
from geolet import Point, CircleWithRadius, Segment, InvertPoint, autofigure
@autofigure
def invert_point():
O = Point("O", 0, 0, label_dir="SW")
inv_circle = CircleWithRadius(O, 2, color="blue")
# Point inside the circle
P = Point("P", 1, 0, label_dir="S")
# Its inverse is outside (at distance r²/d from center)
P_inv = InvertPoint(P, respect_to=inv_circle, label="P'", label_dir="S")
Segment(O, P_inv, style="dashed", color="gray")
Invert a Line¶
A line not passing through the center inverts to a circle through the center:
from geolet import Point, Line, CircleWithRadius, InvertLine, autofigure
@autofigure
def invert_line():
O = Point("O", 0, 0, label_dir="SW")
inv_circle = CircleWithRadius(O, 2, color="blue")
# Vertical line x = 1
P = Point("", 1, -2)
Q = Point("", 1, 2)
line = Line(P, Q, color="red")
# Inverts to a circle through O
InvertLine(line, respect_to=inv_circle, color="green")
Invert a Circle¶
A circle not passing through the center inverts to another circle:
from geolet import Point, CircleWithRadius, InvertCircle, autofigure
@autofigure
def invert_circle():
O = Point("O", 0, 0, label_dir="SW")
inv_circle = CircleWithRadius(O, 3, color="blue", style="dashed")
# Circle not passing through O
C = Point("C", 2, 0, label_dir="S")
target = CircleWithRadius(C, 0.5, color="red")
# Inverts to another circle
InvertCircle(target, respect_to=inv_circle, color="green")
Circle Through Center Inverts to Line¶
from geolet import Point, CircleWithRadius, InvertCircleThroughCenter, autofigure
@autofigure
def circle_to_line():
O = Point("O", 0, 0, label_dir="SW")
inv_circle = CircleWithRadius(O, 2, color="blue", style="dashed")
# Circle passing through O
C = Point("C", 1, 0, label_dir="S")
target = CircleWithRadius(C, 1, color="red") # Touches O
# Inverts to a line
InvertCircleThroughCenter(target, respect_to=inv_circle, color="green")