Skip to content

Conversation

@EarlinLutz
Copy link
Contributor

@EarlinLutz EarlinLutz commented Jun 23, 2025

Class ImplicitCurve2d is an abstract class for curves which have a function f(x,y) which is zero for all points on the curve (and nonzero elsewhere). Although most common curves (circles, lines, hyperbola, ellipse) can satisfy this implicit f(x,y)=0 condition AND have a parametric form (x,y,) = g(t) for a parameter t, the parametric form is NOT universal, and the "implicit curve" category warrants distinct implementations for some constructions.

The following concrete implementations are included in this category:

  • UnboundedCircle2d -- circle defined by center and radius
  • UnboundedLine2d -- line defined by any point on the line and a normal vector.
  • UnboundedHyperbola2d - a hyperbola with implicit form u^2-v^2=1 in a (possibly skewed) local coordinate system
  • UnboundedEllipse2d - an ellipse with implicit form u^2+v^2=1 in a (possibly skewed) local coordinate system
  • ConstructionConstraint -- a curve reference and constraint type such as tangentTo, perpendicularTo, or fixedRadius
  • ConstraintSet -- an array of ConstructionConstraints, with methods to examine the constraints (e.g. 2 for a line or 3 for a circle) and dispatch to specific computation to produce geometry satisfying the constraints.

The class ConstrainedConstruction contains static methods for common circle constructions. Each of these is a specific method to encapsulate the construction. They may be called directly if caller has identified the combination. If caller has varied construction constraints, they may be passed as an array to the to dispatch logic noted further below.

  • circles
    • tangent to 3 lines
    • tangent to 2 lines and one circle
    • tangent to a line and 2 circles
    • tangent to 3 circles
    • tangent to 2 circles and with given radius
    • tangent to 2 lines and with given radius
    • tangent to a line and a circle and with given radius
  • lines:
    • tangent to 2 circles
    • perpendicular to a line and a circle
    • perpendicular to 2 circles
    • perpendicular to a line and tangent to a circle.
    • perpendicular to a circle and tangent to a circle

The following methods on ConstructionSet have logic to examine 2 or 3 constraints and dispatch to an appropriate method in the lists above:

  • constructConstrainedCircles -- array of 3 constraints dispatched to appropriate circle logic
  • constructConstrainedLines -- array of 2 constraints dispatched to appropriate line logic

(In the tangency constructions, the input circles may be zero radius, i.e. act as isolated points.)

@EarlinLutz EarlinLutz requested a review from MarcNeely June 23, 2025 20:10
@EarlinLutz EarlinLutz marked this pull request as draft June 23, 2025 20:11
@dassaf4
Copy link
Member

dassaf4 commented Sep 2, 2025

Just a reminder to update NextVersion.md with a nice example of the API: code and image output. You can even scrape this from the tests. This will help users see what the API does, and how to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants