Grasshopper

algorithmic modeling for Rhino

Hi all,

I am facing a problem while trying to divide curves according to their curvature. It looks like I am iterating over the same points on each curve but I have been working for some time and my brain is frozen. If you have any suggestions or different ideas on how to divide a curve according to its curvature in C# please share.

Thanks in advance!

 

 

        Double Scalefactor = -Factor;

        for (int i = 0; i <crvList.Count; i++)

        {

           

            GH_Path Apath = new GH_Path(i);

            GH_Path Bpath = new GH_Path(i);

            ////***Reparameterize each curve

            Interval myint = new Interval(0, 1);

            crvList[i].Domain = myint;

           

            for (int j = 0; j < Divisions; j++)

            {

                Apath.AppendElement(j);

                Bpath.AppendElement(j);

               

                Point3d Point = new Point3d();

                Vector3d Vec = new Vector3d();

                Vec = crvList[i].CurvatureAt(j/Divisions);

                Point = crvList[i].PointAt(j/Divisions);

               

                A.Add(Point,Apath);

                B.Add(Point + Vec*Scalefactor, Bpath);

               

               }

           

        }

 

 

 

 

Views: 772

Replies to This Discussion

How does the curvature affect the division? What is the algorithm you'd like to see implemented?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hey David,

 

I found this piece of code online that seems to do what i want. The code is written in VB Legacy and I wanted to give it a shot to see if translating it into C# would work the same. I am attaching a Rhino file and a gh file. Again thank you for the great support!

Attachments:

Ok, that code generates a sort of CurvatureGraph, it doesn't do division of a curve based on curvature. I translated it into RhinoCommon C# (see attached).

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thank you David,

I made a grasshopper definition as a pseudocode that I am step by step translating to C# to divide the curve based on its curvature and I think I am going with that one eventually. I wanted to see if this piece of code that I sent made sense to you. Again thank you for your time. I am sure I will bother you again during my translation. Thanks!!!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service