Grasshopper

algorithmic modeling for Rhino

Hello! Can anybody give some ideas to solve this? I have a point O, and have an algorithm to construct another point P, and I want point P to be as close as possible to O. Now this algorithm involves 2 variables. How can I determine the values of the 2 variables respectively, so that I can get the desired point P? 

Hope this is clear enough to explain my problem. Thank you in advance for any help!

Views: 625

Replies to This Discussion

Hi Lezhi,

what do the two variables represent? What are the constraints?

--

David Rutten

david@mcneel.com

Hi David,


Thanks for the reply! What I'm trying to do is this:

I have a line 1 which originates from O1, I evaluate an A1 at a certain distance, from A1 I draw A1-O2 (the distance from A1 to O2 is predefined), keeping it perpendicular to line 1. Now I get O2, the origin of line 2.

To get the direction of line 2, I cross-multiply the vector O1-A1 and the vector A1-O2, and then rotate the cross-product around the axis A1-O2, the rotation angle is ALPHA.

Then I evaluate A2, keeping O2-A2 = O1-A1. From A2 I draw A2-O3, the distance of which equals to A1-O2. To get the direction of A2-O3, I rotate the direction of A1-O2 around the axis O2-A2, the rotation angle is BETA.

Then repeat the process to get line 3 and line 4. From line 4 I can get the position of O5 (O5 is the point P in my previous post), and I want O5 to be the same as O1 (or as close as possible).

The two parameters are ALPHA and BETA. Quite a complex process, hope the explanation is clear enough. Basically I just want to calibrate ALPHA and BETA so that O5 can be close enough to O1.

[...] keeping it perpendicular to line 1. Now I get O2, the origin of line 2.

This is underdefined. There is an infinite amount of perpendicular directions away from a line in 3D space. If the operation is constrained to a 2D plane then there are only 2 possible perpendicular vectors.

Other than that the problem is now clear to me. There may well be a trigonometric exact solution to this problem, but perhaps you'd be happy with a solution using Galapagos?

--

David Rutten

david@mcneel.com

Hi, 

Thanks a lot! To clarify, the direction of A1-O2 is pre-defined, in other words it's a unique, determined value. 

Yes there is a exact solution but it's quite difficult to calculate it manually. So you are talking about evolutionary algorithm? I was just thinking about it but didn't know there is a plugin for EA. Thanks for the information! I think I'll try to learn to use it and perhaps I will have other related questions to ask you later.

If you upload the file you have with all the variable angles as sliders, I can hook it up to Galapagos for you.

--

David Rutten

david@mcneel.com

Hi David!

I'm not sure whether you are familiar with Hoopsnake. I want to do the process above with Hoopsnake, but had some problems, described here

http://www.grasshopper3d.com/group/hoopsnake/forum/topics/hoopsnake...

Do you have any solutions for that? You are already familiar with my problem so I think your suggestions will be valuable.

Thank you very much!

Wow, amazing tool! The result is very satisfactory so far. Thank you very much!

有意思的问题看来已经解决了

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service