algorithmic modeling for Rhino
Hi
Im building an algorithm to use to parametrically build windows in rhino
My issue is that when i calculate the normal of the surfaces (which i need to extrude my mullions), the normals are often in opposite directions. This means that some mullions are being extruded the wrong way! My only option at the moment is to click on each one by one and extrude in the opposite direction. But i would prefer if the algorithm could calculate everything at once.
Any suggestions? is there an easier way to extrude in the right direction??
Ive attached my files
Tags:
Used Dot Product (Google that) to test a given Vector VS - say - a Surface.NormalAt Vector: if this is negative it means that the 2 Vectors have opposite directions: meaning that you should flip the Vector in question (the extrusion direction, that is).
BTW: go there and use the interactive applet:
http://mathinsight.org/dot_product
BTW: if you are interested about how exactly the Dot (double) /Cross (Vector3d) are calculated:
public double DotProduct(Vector3d v1, Vector3d v2){
double dot = (v1.X * v2.X) + (v1.Y * v2.Y) + (v1.Z * v2.Z);
return dot;
}
public Vector3d CrossProduct(Vector3d V1, Vector3d V2){
Vector3d cross = new Vector3d (
(V1.Y * V2.Z - V1.Z * V2.Y),
(V1.Z * V2.X - V1.X * V2.Z),
(V1.X * V2.Y - V1.Y * V2.X));
return cross;
}
great thanks. ill tweak the script throughout today using DotProduct and if i get it to work i'll upload the results... should be a handy tool for everybody!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by