Angle at spline

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Angle at spline

Post by CVH » Mon Aug 05, 2019 11:52 am

Win7pro Qcad3.23pro wininstaller 32bit

Refering to the spline in the attached file, just any spline.

[code]
// with entity isspline
var shape = entity.castToShape();
var aaa = shape.getAngleAt(12.200,RS.FromStart);
// OR
var castPoint = shape.getPointWithDistanceToStart(12.200);
var bbb = shape.getAngleAtPoint(castPoint);
[/code]

Angle aaa differs with bbb with a small amount up to 0.1 degree.
I can't find the source of that even with all scripts loaded to my script folder.
In the debugger the differences come from 'native code'.

Graphing them shows a periodic nature. A higher frequency and an lower one.
See screengrab: 1/2 period at low frequency & 11 periods of about 5 units.

I am intrigued with the source for that.
I persume Qcad uses biarc poly intermediate to do the math.
And as there is a proven flaw with the biarcs I am troubled.
https://qcad.org/rsforum/viewtopic.php?&t=4859

Can you point out the better solution?

Regards

PS The layer 'Rope' is a sneak preview for what I need the tangent at a point.
Bending the rope.
Attachments
Spline AngleAt diffs.png
Spline AngleAt diffs.png (38.15 KiB) Viewed 8286 times
Spline representation isoff.dxf
(410.1 KiB) Downloaded 600 times

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”