I am using the intersection of two circles to define the end point of two lines with fixed length and variable angle. When the circles intersect, there are actually two points of intersection. Fortunately, QCAD is currently choosing the preferred location. My concern is that QCAD may not always do so and choose the other intersection, which will not produce the desired results.
I've attached the drawing file for your reference. How is QCAD choosing one point over the other and is there anything I can do to restrict the selection to the leftmost intersection point?
Thank you for your time,
Lori
Choices when getIntersectionPoints Returns Two Points
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Full Member
- Posts: 84
- Joined: Sat Nov 03, 2012 2:00 am
Choices when getIntersectionPoints Returns Two Points
- Attachments
-
- CircleIntersections.dxf
- (107.27 KiB) Downloaded 431 times
Re: Choices when getIntersectionPoints Returns Two Points
The function getIntersectionPoints actually returns an array of all solutions (hence the plural).
Output:
var c1 = new RCircle(new RVector( 0,50), 100); var c2 = new RCircle(new RVector(25,50), 100); var solutions = c1.getIntersectionPoints(c2); for (var i=0; i<solutions.length; i++) { qDebug(solutions); }
Output:
Debug: RVector(12.5, -49.2157, 0) Debug: RVector(12.5, 149.216, 0)
-
- Full Member
- Posts: 84
- Joined: Sat Nov 03, 2012 2:00 am
Re: Choices when getIntersectionPoints Returns Two Points
Andrew,
I should have qDebug(ged) it to see the return. Didn't even occur to me. I have to constantly remind myself that all the data is there for the taking, I just have to ask.
I can write a conditional to choose the point, if more than one is returned, that is the smallest in the X coordinate. It should work perfectly every time.
Thank you.
I should have qDebug(ged) it to see the return. Didn't even occur to me. I have to constantly remind myself that all the data is there for the taking, I just have to ask.
I can write a conditional to choose the point, if more than one is returned, that is the smallest in the X coordinate. It should work perfectly every time.
Thank you.