MoI discussion forum
MoI discussion forum

Full Version: Script for Curvature Calculation

Show messages:  1-13  14-24

From: Karsten (KMRQUS)
25 Apr 2014   [#14] In reply to [#12]
Hi Brian,

it seems that the DetA sometimes isn't zero for linesegments. So, caused by a division near zero, it produces very high values for the centerpoint. That crashes the factories, esspecially for interpcurve. I've try to fix it by limitation of a maximum radius of 10000 and a minimum radius for curvature calculation of 0.002 (csp returns for lines p1 - that leads to a radius of zero -> divide by zero - > high values for the factories). Further more the changes supresses the generation of degenerated lines (startpoint equals endpoint). I've marked the changes in the script with //############. Also I made some test with the results with another tool. You may have a look at the pictures. It seem that other tools seperates connected curves for the analyse. So the precission at the connection points, especially with lines, isn't good.

Have a nice day!

Kind regards
Karsten

Attachments:
ccc.zip

Image Attachments:
elipse.jpg  rounded-corner-G3.jpg  rounded-corner.jpg  sr1.jpg  sr3.jpg 


From: bemfarmer
27 Apr 2014   [#15]
After many difficulties, I finally made a version using some htm code, which may be 10% faster.
It is not much of a speed up. It does show the ongoing point generation, and leaves the start point.
Some code was separated. Some code was moved to htm script.

I'm going to work on a helix script now.

- Brian

Attachments:
CCC02SlightlyFaster.7z


From: Hamish Mead (HAIRYKIWI)
7 Mar 2015   [#16]
Hi Karsten,

Thanks for your script - and to Brian too for giving it a speed tweak.

The math of your script looks really interesting. Unfortunately, I don't have enough time right now to get back up to speed on matrices and work my way through your code. If you think the Gaussian elimination method for multiple linear equations would give a significant speed advantage over the Cramer method - and I can see how it might - then the following page offers a ready to use javascript function and may be worth a look:
http://martin-thoma.com/solving-linear-equations-with-gaussian-elimination/

When I ran your script run on the output from my NACA airfoil generating script, it looks very close to what Rhino's own curvature analysis was giving, (I originally started developing my script in RhinoPython). Sorry I don't have consistent screen captures of identical airfoil series to show from MoI and Rhino, but you get the idea:








Cheers,
Hamish

Image Attachments:
karstens_curvature_analysis_MoI43012-001.PNG  karstens_curvature_analysis_MoI43012-002.PNG  rhino_curvature_analysis_rhino43012A-001a.PNG 


From: Karsten (KMRQUS)
10 Mar 2015   [#17] In reply to [#16]
Hi Hamish,

Thank You for the interessting link and I am glad to here, that the script is interessting for you.
yes, I think that a gaussian method could be faster, also for this small matricies. But, I have some Problems at the Moment: Frist - Time(as we all;-). The second enlarge the first Problem. The script has a serious design error, that kills also the performance. The function for calculating the centerpoints (csp) has 3 points as Parameters. So every call, biscectional planes were calculated - for the next call the second plane of the previous calculation is the first of the actual calculation. So I have a lot of redundant plane calcs. To improve the Performance a lot of changes have to be done.

Kind regards
Karsten
From: Frenchy Pilou (PILOU)
20 Dec 2017   [#18]
@ Karsten From the other thread! (where was the "ccc" );)
and this mysterious line (for me at first view)

<< The script without coloring and the node is in the extensions under infos. Insert the node, connect a curve to it and the out to an output. Press run - that's it.

A sort of miracle! :)



I have just a doubt in what folder put the ccc.js and ccc.html (so i put them both commands and nodes folders ! )

despit of that seems that's is working like a charm! :)

and damned I must translate an another node! :)

Edit: In fact a lot of !!! (all extentions' nodes that i have missed! Not only the "infos" but all the rest! :D

Here only the Infos/ "Curvature" French Translation is made!



PS That will be a task to find what was the start curve who give this last Blue/Red colorized drawing! ;)

In fact easy if you can zoom ! ;)

Just a question : why the curve selected dont stay drawn during the application of the Infos node ?



And does it normal that a simple circle gives an "open result" ? (same for the ellipse of the first image of this post)



An hard day comes with all that to translate! :)
From: Karsten (KMRQUS)
20 Dec 2017   [#19] In reply to [#18]
Hello Pilou,

the problem of the open analysis curve for closed curves is caused by the patharray factory. The script works with a startpoint of the curve, arrays it to the curve and calculates the center of an theoretical arc for 3 following points. For a closed curve the arrayfactory don't calculate the last point, because it's the same as the start point. It's possible to improve that, but for the analysis it has not an effect, because the start and end point would need a previous point and following point. I solved that with a lagrange interpolation. The old script don't calculates start and endpoint. Ccc has to be placed in the command folder. It is complete independent from the node stuff. It's older than the elephant. Please play with the number of sample points and rhe scale factor.

Have a nice day
Karsten
From: Karsten (KMRQUS)
20 Dec 2017   [#20] In reply to [#19]
p. s. If you want to see also your curve in the nodeeditor while running a curvature analysis you can clone it first and give one clone to a second output node.
From: Frenchy Pilou (PILOU)
21 Dec 2017   [#21] In reply to [#20]
Thx for all these infos!
It's not precisely for me but for French people who will ask me that! :)

About the double curve by clone : very tricky simple!
I'm sorry I didn't find it all by myself!

Have happy Christmas...and coding!
See you the next year!
From: Frenchy Pilou (PILOU)
21 Dec 2017   [#22]
What is CCC ? Construction Curvature Calculation ?

Seems there is something! Like there is no title appropriated?

In English I have 2 Lines : (and not Select Curve(s) to Analyse! )
Choose Number
of Sample Points






Result!


From: Karsten (KMRQUS)
21 Dec 2017   [#23] In reply to [#22]
I saw a film, there was some saying : Give me names of wild animals! Answer: Evil butterfly!

My first mind was calculate curves curvature, but it's to long so CCC, but I can't speak french so it's up to you how you will translate it. The right name in english is comp curve, I think. I read also porcupine analysis, but I think it's for surfaces and also a word used by Dassault. I'm not shure if they can english really. Some other naming in CATIA was raising my doubts in the past;-) Anyway, In french most of the things sounds better and more graceful.

Have a nice day
Karsten
From: Frenchy Pilou (PILOU)
21 Dec 2017   [#24] In reply to [#23]
No, my question was not about some names of things (except CCC) but just why that is writed inside the code is not shown on the panel !
Aespecially on the title!

I have offseted the text lines on the Nopad++ for have the right thing! :)


Show messages:  1-13  14-24