### Author Topic: Is there a way of calculating a segments angle relative to World X  (Read 392 times)

#### RC2292

• Newbie
• Posts: 19
##### Is there a way of calculating a segments angle relative to World X
« on: February 07, 2020, 08:29:20 PM »
Hi,
Newish to Railclone and am after a steer to work out how I can drive the evenly count and X size in a linear area with the angle of the spline segment driving it.

I.e. the the higher the angle 0>90 the larger the object x size and evenly number.

Hope that makes sense.

Thanks

#### Dragan

• Sr. Member
• Posts: 496
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #1 on: February 07, 2020, 09:24:22 PM »
Hi, I don't quite understand. Maybe you can give us an example.

#### RC2292

• Newbie
• Posts: 19
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #2 on: February 07, 2020, 11:05:34 PM »
Yeah sorry Dragan, made a bit of a meal explaining what I'm after.

Essentially I'd like to output the angle of the spline segment relative to the ground plane and then use that to drive other elements.
Hope the attached screen grab helps explain this.

#### Dragan

• Sr. Member
• Posts: 496
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #3 on: February 08, 2020, 07:16:32 AM »
Hm, I'm not sure yet what you want to achieve.
How the segments are distributed if Angle=0 or Angle=90.
If you are looking for something like a staircase solution then this official tutorial could help you:
https://www.itoosoft.com/tutorials/stairs?back=page%3D1%26search%3Dstai

#### RC2292

• Newbie
• Posts: 19
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #4 on: February 08, 2020, 12:58:50 PM »
Ah yes the staircase is a great starting point.

The main thing I want to change is to ALWAYS have the treads the same height, regardless of the angle of the spline.
You can see that the stairs using the shallower angle in the screen grab have shorter treads. I'd like to always specify the height of the treads.

Maybe I was trying to find a convoluted way of doing this but I assumed that starting by outputting the angle of the segment driving the stairs would then allow me to adjust the height of the treads via expressions.
Probably totally over complicated the approach and hence very confusing  .

Thanks for persevering Dragan!

#### Dragan

• Sr. Member
• Posts: 496
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #5 on: February 08, 2020, 02:09:15 PM »
I don't think you can satisfy both conditions, the height of the steps and the angle because the height of the treads dictates the angle.
You can start by setting the Tread Height and move up each next tread by this value.

#### RC2292

• Newbie
• Posts: 19
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #6 on: February 09, 2020, 02:31:55 PM »
That's a great start thanks Dragan.

Is there a way of getting the vertical length of the spline segment?
I could then use that output divided by the step height (rounded) to drive the count number in mode.
That should work, right?

Just not sure how to get the height of the spline segment.

Thanks again

#### Dragan

• Sr. Member
• Posts: 496
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #7 on: February 09, 2020, 04:35:50 PM »
Just not sure how to get the height of the spline segment.

Just introduce the new Numeric node for `Total height` and do necessary arithmetic. But I think that way you will not always be able to `tangent` top distance because of the mentioned roundness factor.

You can`t combine Total Height and Step Segment Height because those two are directly dependent on the calculation.
You could go with Numbers of Steps or approximately the height of the Step Segment.
« Last Edit: February 09, 2020, 04:53:54 PM by Dragan »

#### RC2292

• Newbie
• Posts: 19
##### Re: Is there a way of calculating a segments angle relative to World X
« Reply #8 on: March 04, 2020, 02:37:07 PM »
Hi Dragan
REALLY sorry! I totally missed this post.
Will have a look now thanks for your time and apologies again for the delay getting back.