In this session, I will add two new methods to the Vector class. I think this will finish the basics for the vectors. In the future, we are going to need several new methods like adding multiple vectors and interpolation. But for now, I think this would be sufficient to further advance into parametric curves and surfaces. These new methods will be based on the dot product method we created […]
Posts categorized under Linear Algebra
This is the continuation of the Vector class we started here, and further advanced here, here, and here. This new Rhino Python implementation is mostly educational and partially a hobby. Before this session, we have developed display, magnitude, add, multiply, reverse, and subtract methods. This time, I am adding the vector normalization and dot product methods and seeing the utilizations of the dot product. Line Explanation 1-26 Already explained in […]
Today, I am going to make only one addition to the Vector class we recently started in Rhino Python. The magnitude of a vector can be easily calculated by assuming that the axes (2 or 3 axes) of it are perpendicular to each other. This gives us an opportunity to assume a right triangle visually, and calculate the magnitude (length) of a vector by using the Pythagorean Theorem. In short, […]
This is the continuation of my new project of re-creating the parametric curve and surface methods of Rhino via Python scripting. If you remember, I started with the building block of vector operations, here and here. Then, I defined vector addition and multiplication, before going deeper into the geometric calculations. In fact, they are using the previously defined addition and multiplication methods. New Vector Operations: Subtraction and Reversing In the […]
Today, I am going to advance the Vector class a bit more. Firstly, I will improve the display method I introduced recently. Then, I will add two new methods which handle the fundamental vector arithmetics in Rhino Python. Improving the Display Method In the previous attempt, I displayed vectors on the origin of the Rhino viewport. The coordinates of the tail of a vector are not stored within the object […]
Let’s continue from the Vector class that started yesterday. Previously, I defined this class to store three numbers (coordinates), named as “components”. I defined a method named __init__ for this. Similarly, I am adding a display method to the Vector class today. Note that I am using Rhino 6 in this code, but it should also work in Rhino 5 or 7. The code Below is the line-by-line explanation of […]
In this new series, I will be using Rhino Python to create some of the fundamental mathematical objects in Rhino. We will learn how to code in Python, and also try to get deeper into the intuition behind some of the fundamental concepts we use every day in Rhino and Grasshopper. The Vector class in Rhino Python is the starting point of this journey. Just like vectors, most of the […]
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 to check the relative orientation of points. In this script, the direction is the cross-product determinant that determines the relative orientation of the points. If the result is negative, the […]