How to smoothly rotate a sweep/multiple points around a set point?

I have created a track by constructing points to form a polyline, and then sweeping around a curve that I selected in Rhino. I have done this for 2 rails (created a curve and an offset curve and used sweep 2 for both).

Now that I have the track on flat ground, I have created a point above the track where I want both the rails to rotate. I want to allow, at each section of the track selected, for it to rotate around the point above the track selected. I have sketched out how I would like this to look.

This is so that I can create a “banking angle” of the section at different points along the track. I want to be able to select a point, and for the rail to gradually bank until its at the target angle (at that point), and then at the next point, gradually return to flat.

Rhino track code.gh (70.3 KB)

geometry not internalized. without the geometry the file wont work.

number of rotation centers and section does not match.

so the rotation of each section should depend on the curvature/radius of the railcurve at that specific point?

track_code_jvs01.gh (38.9 KB)
sketching…

Hi there,

I’ve drawn a very rough sketch of the sort of thing I’m going for.

By the looks of your code, that’s definitely the sort of thing I’m trying to do! Thank you for your help.

Any advice on the sorts of things I should learn in Grasshopper to practice this? I’m still relatively new to it.

So the Rotation does Not depend in the curvature. Where do the Rotation values come from?

Upload your input geometry.

Rhino track code_rp00.gh (42.3 KB)

Ok, first thing to say is that your profile generation is massively overcomplicated. When you have a handful of X and Y coordinates like this, you can just merge them in the right order and feed that into a single Construct Point component.

Once you have a simple profile object, you just use Perp Frames and Orient to copy the profile to each “station”. They can then be rotated into place. Here’s an example with a single bank angle transition:

Rhino track code_rp00.gh (42.3 KB)

For the more complex version, how do you intend to specify the bank angle?

  1. At even spacing?
  2. At specific locations chosen by you?

If 2, then do you want to

  1. Specify the points by slider (eg at 0.32 of the way along the curve, set the angle)
  2. Specify the points in the viewport (eg by placing Text objects with the desired angle)
1 Like

Hi there,

So my intention is currently this:

Say there is a section of track that needs a banking angle (e.g. approaching a sharp corner), I want to be able to select either a point or multiple points that will bank to an angle which I choose to input. This banking will have a rotation centred around a point above the track.

Further to my point about it being “smooth”, I want to have a lead-in and lead-out of the banking angle just before the curve and just after, again within a range that I have selected.

So it will go like this:

  1. Starting to approach the curve, the track starts to rotate (rotating around the centre curve above the track)

  2. It will rotate until it has reached the point (or points) that I have specified to be the maximum banking angle.

  3. Immediately after the curve, it will rotate until it is back to a flat (upright) position.

To answer your question, it most likely falls into: at specific locations chosen, specifying the points in the viewport.

Thank you very much for your help.

Hi Jakob,

I’ve just replied to Tom’s comment below, I hope that makes it a bit clearer.

Curse you for posting an interesting problem :smiley:

First, my Query Model Objects is giving an error:

Solution exception:The type initializer for ‘Grasshopper.Rhinoceros.Display.ModelDisplayMode’ threw an exception.

So I have directly referenced some points and aded sliders to adjust the angle at each one.
You should be able to disconnect my temporary setup and hook up the Query Model Objects.Then you can add as many bank angle Text Blocks as you like on the Angles layer. Note that a zero angle point is required just after the start point of the curve. This is highlighted with a circle. This process could be automated but I am very tired now :smiley:

The method has the following blocks:

Collect the track and bank angle data and analyse each pair of angles to test for flat sections. Do a test for a closed or open track and modify the data a little accordingly.

Create a “graph” of bank angle (y) vs frame no (y). The flat sections stay as flat lines. The banked sections are interpolated with flat tangents.

Lookup the Y value at each frame no. and send those to the profile rotation

Meanwhile, check if the curvature is concave or convex and move the rotation point accordingly so that both types of bend will raise the correct side.

Then Loft as before.

The .3dm includes the track curve and the bank angle text blocks, as well as my temporary points, which you can delete once you have Query Model Objects working.

banked track.3dm (121.8 KB)

banked track.gh (37.4 KB)