# Itoo Software Forum

## RailClone => RailClone Pro (*) => Topic started by: Pixelab on October 16, 2020, 05:08:05 PM

Title: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Pixelab on October 16, 2020, 05:08:05 PM
Here is a glass railing from above, I'm trying to make a formula that automatically makes the space between the glass. Circled in red are the corner not working properly (180°+ angles)

Looks like RC do the job correctly for sub 180 angles.

I've tried many solution but can't get the right trigo formula. Would be nice to be able to paramter it with min/max spacing values.

FWIW I've attached the file I'm working on but the expression is a mess. RC version is 3.1.8b, Max 2016

(https://i.imgur.com/ZrUdqXi.png)
Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Rokas on October 16, 2020, 05:18:02 PM
Hi

How should it look correctly when angle>= 180 ?
Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Pixelab on October 16, 2020, 05:34:47 PM
Hi

How should it look correctly when angle>= 180 ?

With a space enough to avoid collision between the elements (see the overlap circled in red)

I guess the formula will give infinite for 360°
Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Dragan on October 16, 2020, 08:12:21 PM
Hi
Check this generator. I added a few more parameters so now you can have different spacers for Evenly and Corners 1 & 2 which are controled by the Angel Threshold parameter.
Please let me know if this is works for you.
And as Rokas ask, we need to know how spacing will change when angle is greater than 180.

Best Regards
Dragan
Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Dragan on October 16, 2020, 11:05:38 PM
I just saw you are using RC 3...
Please go to RC4, you will not regret it ;)
I`m not sure this will work on RC3 but you can try.

Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Pixelab on October 19, 2020, 03:00:34 PM
Thanks for the help, but what I'm looking for is a dynamic formula that spaces the glass enough to avoid collisions.

I know it involves trigonometry but so far my attempts have been unsuccessful.

This was for example a formula to scale an object based on the Vertex Angle

Code: [Select]
`return 100/cos((pi-XVertexAngle)/2);`
Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Pixelab on October 19, 2020, 05:56:35 PM
Ok, I finally found the formula I was looking for.

I've attached the max file for those who are intrested

Code: [Select]
`return (tan((pi-XVertexAngle)/2)*Input1)+Input2;`
Input1 is the space you want at 270°
Input2 is the minimum space used for sub 180° angles

(https://i.imgur.com/47HGkhb.png)
Title: Re: Spacing within a railing - Looking for the correct trigonomerty expression
Post by: Dragan on October 20, 2020, 08:45:52 AM