Convex Hull with Rhino Python

by Tuğrul Yazar | July 28, 2017 01:08

This Rhino Python code calculates the cross-product determinant used to determine the orientation of three points (current, next_point, and point) to see if they form a left turn or a right turn. This is a well-known technique in computational geometry[1] to check the relative orientation of points. In this script, the direction is the cross-product[2] determinant that determines the relative orientation of the points. If the result is negative, the point is to the right of the line from current to next_point, indicating a clockwise turn. On the other hand, if the result is positive, this means they are counter-clockwise. If the result is zero, this means the points are collinear. Therefore, the algorithm correctly identifies the points that form the convex hull by wrapping around the set of points.

convex hull

The Convex Hull Generator for Rhino is a tool designed to create convex hulls from selected point clouds. It uses the gift-wrapping[3] algorithm (Jarvis March). Thus, users can select points within Rhino, and the script will calculate and draw the convex boundary by connecting the outermost points. This tool ensures precise and efficient hull generation, suitable for architects, designers, and engineers working with point cloud data. It is also educational for those who want to understand the cross-product.

convex hull[4]

You can re-write the code in the image. However, if you want to support this website by downloading my Python file; would you consider being my Patreon? Here[5] is the link to my Patreon page including the Rhino Python code for Convex Hull and more. Thank you very much for your support.

convex hull
Endnotes:
  1. computational geometry: https://www.designcoding.net/category/research/computational-geometry/
  2. cross-product: https://www.designcoding.net/category/research/linear-algebra/
  3. gift-wrapping: https://en.wikipedia.org/wiki/Gift_wrapping_algorithm
  4. [Image]: https://www.designcoding.net/decoder/wp-content/uploads/2017/07/Convex-Hull-with-Rhino-Python-def.jpg
  5. Here: https://www.patreon.com/Designcoding

Source URL: https://www.designcoding.net/convex-hull-with-rhino-python/