Grasshopper

algorithmic modeling for Rhino

# Magnetic Line Orientation issue...

Hi All.

I'm attempting to create a definition that rotates lines based on their proximity to a point, which I've more or less managed to do. However, I'd like it so that the lines rotate in either a positive or negative angle depending on which side of the line the point is on.

To clarify, take a look at what my definition is doing, then take a look at the image attached. I'd like my definition to produce results like you see in the attached jpg, which was done using a script.

Perhaps I can split the Y vector into two lists, positive and negative, and have those influence whether the angle of rotation for each line is positive or negative?

First post here, anxious to see how this goes....

Thanks!!!

ps. I should add that eventually I'll be wanting to use multiple attractor points.

Views: 1198

Attachments:

### Replies to This Discussion

You weren't far off with the Decompose Vector solution. But the actual way to achieve this is to get the cross product of the vectors (one being the original direction of the line) Then the Z component of this result unitized should give you either -1 or 1 indicating which direction to rotate. I'm not quite sure what angle you were calculating so I've given you a general example for the lines to be tangent to the point.

Also note that there is a CurvePoint Component that will give you the mid point directly instead of dividing it up and selecting the correct one.

Attachments:

Danny,

Thank you so much, this is definitely a huge step in the right direction! Really, can't thank you enough.

There is only one more aspect of the definition that I'm having trouble with, which is that if you look at the example image I posted as well as the definition as I had it before, the angles of rotation get smaller as the midpoint of the lines get further away from the attractor point.

I've been grappling with this with little success. I'm not too used to thinking about angles in radians, which is part of the problem.

You can see that I attempted to set a distance range. The idea was that this would determine how far from the attractor point a line would have to be before it was no longer being effected by the attractor point (in this case, the max distance at which lines are effected is 20'). This works, however I'm not sure why I thought that would give me the diminishing angle sort of gradient effect I'm looking for.

I'll try to explain what I think I need to do, however I'm not sure I can do this.

It seems like I need to set up a ratio. For Example:

Distance:      0 to 20

Radian Angle:       (result of current definition) to pi/2

So for example, if there was a line who's center point was 10' (half of total distance) away from my attractor point, it's radian angle of rotation would be halfway between it's current result and pi/2.

There may be a much simpler way to do this, I'm not sure, but any input you have would be more than welcome.

Again, thanks for your help thus far, whether or not you can help any further.

Attachments:

Hi all! It's pity for me. The topic was created 4 years ago and I just have totally the same issue. If anyone could give a hand, I would be much appreciate it!!!

Things have moved on with GH in 4 years rather than elaborating on an old question can you specify what it is you need.

It might be that something along the lines of fields would be of use or another plug-in that does specifically what you are looking for.

Hi Danny!

Thanks for you quick reply. I attached the image of what exactly I'm trying to manage. All results I have tried before, makes the rotation of all lines on the grid oriented or rotated with constant angle. But no success to start rotating lines when it's closer to the point (attractor).

Attachments:

and this the final result I achieved half manually. I made an attractor for quarter of the surface and then mirrored it 3 times :) but now I'm trying to make an animation out of this, but without proper logic of definition it's not working. :(

Attachments:

can you post a definition

Thank you!

Attachments:

Hi Danny!

Just wondering if you have any success? Let me know. Thanks

• View All

## Videos

• ### Conversion Disorder-Series1 - FRDr210 - Iman SheikhAnsar

Added by Iman Sheikhansari

• ### Conversion Disorder-Series1-iFRDr202 - Iman SheikhAnsar

Added by Iman Sheikhansari