Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement 3-point arc curve #144

Open
kaveh808 opened this issue Oct 19, 2022 · 2 comments
Open

implement 3-point arc curve #144

kaveh808 opened this issue Oct 19, 2022 · 2 comments
Assignees

Comments

@kaveh808
Copy link
Owner

In kernel/curve.lisp, implement the function:

(defun make-3-point-arc (p0 p1 p2 num-segments)
  ...)
@kaiwulf
Copy link
Collaborator

kaiwulf commented Dec 1, 2022

@kaveh808 Sorry it's been so long since I've touched this. Life has been very demanding as of late. I was able to take a look at curve.lisp and I have have developed a fairly good understanding of what's going on. My first attempt at making a 3-point curve is to evoke make-line-curve for points p0 to p1 and then from p1 to p2. Using the example from other curve functions I have this so far:

(defun make-3-point-arc (p0 p1 p2 num-segments)
  (make-curve (make-line-curve p0 p1 num-segments ... )
    ))

However, I know I'm missing something. I'm not exactly sure how to use make-curve since I'm pretty new to CLOS. Any hints at where I should go from here or if my start might be off in some important way?

@kaveh808
Copy link
Owner Author

kaveh808 commented Dec 1, 2022

No worries @kaiwulf. Life has a way of doing that.

What I would suggest is computing the diameter and start/end angles of the curve from the 3 points and then calling make-arc-curve.

Something like googling 3 point circle arc may help with the math.

So something like:

(defun make-3-point-arc (p0 p1 p2 num-segments)
  (let ((d <calculate diameter>)
        (theta1 <calculate start angle>)
        (theta2 <calculate end angle>))
    (make-arc-curve d theta1 theta2 num-segments)))

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

No branches or pull requests

2 participants