algorithmic modeling for Rhino
I understood the IsParallel method of Vector3D takes account of direction. However, recent code does not supprot this. Has something changed recently?
In both the following sets of code the debugger breaks where I did not expect. i.e. A vector aligned in the positive World X is seen to be parallel to a vector in the negative World X
Dim rcV1Test As New Rhino.Geometry.Vector3d(1, 0, 0)
Dim rcV2Test As New Rhino.Geometry.Vector3d(-1, 0, 0)
If rcV1Test.IsParallelTo(rcV2Test) = True Then
Dim BBreak As Boolean = True
End If
Tags:
still like to know if the parallel method is supposed to return a true value irrespective of direction.
The way I used to check if parallel and in same direction was to create a local plane using the reference vector as the normal and the start point of the vector as the origin. I then transformed the test vector to this plane. A negative z value for the transformed vector indicates that it is parallel AND in opposite direction to reference vector.
I guess VB will accept an integer as a boolean, I think c# you have to explicitly convert.
From memory (I don't have time to check right now), IsParallelTo returns an integer, 1 if the vectors have same direction, -1 if opposite direction (ie parallel) and 0 if not parallel. So I think you should change your code to
If rcV1Test.IsParallelTo(rcV2Test) = 1 Then
Hope it helps.
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