MoI discussion forum
MoI discussion forum

Full Version: Apollonius circles tangent to circles

Show messages: All  1-3  4-7

From: Michael Gibson
9 Oct 2017   [#4] In reply to [#1]
Hi Brian, by the way the Draw curves > Circles > Tangent command can generate a circle tangent to 3 other curves currently.

> but the question is, can the center of a circle be found like the following var x1 = code which does not work:

Sorry no, currently there isn't anything set up for returning circle properties to script, the only things exposed specific to curves currently are:

crv.isClosed property,
crv.getFacesOfEdge()
crv.getUVCurvesOfEdge()
crv.getStartPt()
crv.getEndPt()
crv.getLength()


> Second question, is the c1.radius code OK?

I don't think so - I'd think it is returning "undefined".


> Third question, is a circle just another curve, or is there objectpicker
> code to restrict selection to circles?

Sorry no there isn't currently, the current ones are just by more general object type than that:
allowCurves();
allowStandaloneCurves();
allowEdgeCurves();
allowFaces();
allowBReps();
allowPointObjects();
allowEditPoints();
allowTopLevelObjects();

Probably a good way to add a more flexible one would be to let you pass in a function that the objectpicker would then call to decide if an object should be allowed to be picked or not.

Those are some things that I can add in for you in v4 once it's underway. Not too much longer...

- Michael
From: bemfarmer
9 Oct 2017   [#5] In reply to [#4]
Thank you very much Michael!

BoundingBox center should do nicely.

Looking forward to MoI4.

- Brian

Well CircleTan command does create the desired tangent circle.
From: bemfarmer
9 Oct 2017   [#6] In reply to [#5]
I think that the CircleTan command has the Apollonius algebra built in.
- Brian
From: Michael Gibson
9 Oct 2017   [#7] In reply to [#6]
Hi Brian,

re:
> I think that the CircleTan command has the Apollonius algebra built in.

CircleTan uses an iterative solver technique - that's when given some "seed points" to start with it takes little steps on each curve and sees which directions are getting closer to a good result. Then smaller and smaller steps to converge in on the answer.

The tricky part with that kind of solver is getting good seed points, it tends to work well when you can guide it by picks in the general region where you think the answer should be.

The good part about it is that it's very general purpose, it can find a circle tangent to 3 general curves, not just 3 circles:


- Michael

Image Attachments:
circle_tangent_to_3_curves.jpg 


Show messages: All  1-3  4-7