Kangaroo

THIS FORUM IS NO LONGER ACTIVE. PLEASE POST ANY NEW QUESTIONS OR DISCUSSION ON:

https://discourse.mcneel.com/c/grasshopper/kangaroo

The discussions here are preserved for reference, but new questions posted here are likely to go unanswered.

Kangaroo is a Live Physics engine for interactive simulation, optimization and form-finding directly within Grasshopper.

PolygonArea orientation and accuracy

Does PolygonArea require the polygon to lie on a plane parallel to WorldXY? As far as I can tell, any other orientation causes an inaccurate result, and a plane lined up directly with Z causes it to cease working at all.

The python script here is calculating an area by dividing into triangles from the center of the polygon and summing their individual areas. Rhino's AreaMoments command agrees with its result. The goal's target area and final calculated areas are identical if I set the plane to WorldXY.

I've looked over the PolygonArea.cs source and I admit I find the use of a Vector3d.CrossProduct's .Z for an areadoubled to be some kind of voodoo. If I modify the algorithm to use the .X or .Y I can change which plane works and which fails, but my current use case involves computing multiple polygons with arbitrary orientations.

Any advice?

Load Previous Replies
  • up

    Cory

    Thanks, I think I have a better grasp of the math involved now. I wrote a modified version of the goal in python which uses Plane.FitPlaneToPoints and maps the points over before computing in order to get accurate results for any polygon orientation. A non-planar polygon will still be an approximation, of course, but combined with a CoPlanar goal this always seems to produce correct areas.

    I'm not sure how much of a performance hit it incurs, but it would need to be ported back to c# to make a good comparison to the stock code to find out.

    1
    • up

      naasaki

      If you're interested in learning how to solve equations, there are many ways to learn math riddles. There are a number of different options, but these three programs have some key features in common. The first is a structured approach. Students can learn the fundamental concepts of each grade level with these courses, which were carefully chosen by a team of experienced teachers. Whether you're looking for a U.S. or Canadian version, these programs should be able to help.

      • up

        PoulMaclein

        what a great polygon, you really did it perfect