POV-Ray : Newsgroups : povray.general : HELP - Rotating Railing Posts around Scaled Cylinder Edge Server Time
1 Nov 2024 03:17:54 EDT (-0400)
  HELP - Rotating Railing Posts around Scaled Cylinder Edge (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Sven Littkowski
Subject: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 28 Mar 2018 00:23:11
Message: <5abb18af$1@news.povray.org>
Hi,

if I want to distribute railing posts around the edge of a regular
CYLINDER (scale 1.0) it is easy: I would use something like

object
{
 RailingPost
 translate < MyCylinderRadius, 0.0, 0.0 >
 rotate < 0.0, MyAngle, 0.0 >
}

But what would be the formula for distribution, if the cylinder has been
scaled unevenly, like this:

cylinder { < 0.0, 0.0, 0.0 > < 0.0, 1.0, 0.0 > scale < 0.5, 1.0, 1.0 > }

I need two algorithms:
- one for placing each post by myself
- one to place all posts with a WHILE loop

Thanks a lot.

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Bald Eagle
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 28 Mar 2018 06:30:01
Message: <web.5abb6d91862735805cafe28e0@news.povray.org>
A scaled circle is an actual ellipse.

If you're able to plot out an ellipse a la Kepler, then that will solve your
problem.


Post a reply to this message

From: Sven Littkowski
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 28 Mar 2018 07:56:32
Message: <5abb82f0@news.povray.org>
Very unfortunately, I am not Kepler or anywhere close to this blessed
mathematician and astronomer.

I think,  I still need a formula...

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: clipka
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 28 Mar 2018 10:33:22
Message: <5abba7b2$1@news.povray.org>
Am 28.03.2018 um 06:22 schrieb Sven Littkowski:

> But what would be the formula for distribution, if the cylinder has been
> scaled unevenly, like this:
> 
> cylinder { < 0.0, 0.0, 0.0 > < 0.0, 1.0, 0.0 > scale < 0.5, 1.0, 1.0 > }
> 
> I need two algorithms:
> - one for placing each post by myself
> - one to place all posts with a WHILE loop

Google "equidistant points on ellipse" for a point to start.

Or go here, which is where google took me:

https://math.stackexchange.com/questions/172766/calculating-equidistant-points-around-an-ellipse-arc


Post a reply to this message

From: Bald Eagle
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 28 Mar 2018 11:05:00
Message: <web.5abbaebf86273580c437ac910@news.povray.org>
https://en.wikipedia.org/wiki/Ellipse#Polar_form_relative_to_center

#declare r = ab / sqrt(b*pow(cos(theta),2) + a*pow(sin(theta),2)) / theta;

then translate by r, and rotate by degrees(theta)


Post a reply to this message

From: Bald Eagle
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 28 Mar 2018 19:30:00
Message: <web.5abc2465862735805cafe28e0@news.povray.org>
#version 3.7;
// Bill Walker "Bald Eagle" March 2018

global_settings {assumed_gamma 1.0}
#include "colors.inc"

camera {
                            location  <0, 10, -0.01>
                            right    x*image_width/image_height
                            look_at   <0, 0, 0>}

light_source { <0, 150, 0>  color rgb <1, 1, 1>}

plane {y, 0 pigment {Gray10}}

#declare a = 1;
#declare b = 4;
#declare r = 0;
#declare o = <0, 0, 0>;

#for (theta, 0, tau, 0.1)
 #declare r = (a*b / sqrt(b*pow(cos(theta),2) + a*pow(sin(theta),2)));
 #debug concat ( " r = ", str (r, 3, 1),  "\n")
 sphere {o, 0.1 pigment {Green} translate <r, 0, 0> rotate -y*degrees(theta)}
#end // end for theta


Post a reply to this message

From: Sven Littkowski
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 29 Mar 2018 19:55:36
Message: <5abd7cf8$1@news.povray.org>
GREAT WORK!

Thanks, well-appreciated. This formula will help me a lot to develop my
ship!

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Sven Littkowski
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 29 Mar 2018 19:59:24
Message: <5abd7ddc$1@news.povray.org>
Thanks a lot! I admit, I did not even know, how to search for this topic
(what search phrase to use). This helps me a lot.

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 29 Mar 2018 21:30:00
Message: <web.5abd9109862735803f1561fd0@news.povray.org>
Sven Littkowski <I### [at] SvenLittkowskiname> wrote:
> Hi,
>
> if I want to distribute railing posts around the edge of a regular
> CYLINDER (scale 1.0) it is easy: I would use something like
>
> object
> {
>  RailingPost
>  translate < MyCylinderRadius, 0.0, 0.0 >
>  rotate < 0.0, MyAngle, 0.0 >
> }
>
> But what would be the formula for distribution, if the cylinder has been
> scaled unevenly, like this:
>
> cylinder { < 0.0, 0.0, 0.0 > < 0.0, 1.0, 0.0 > scale < 0.5, 1.0, 1.0 > }
.....

At the Wikipedia page that Christoph linked to there is a method for a somewhat
even distribution of points around an ellipse:

https://en.wikipedia.org/wiki/Ellipse#Steiner_generation_of_an_ellipse

Try my code below to experiment with this method.


Tor Olav
http://subcube.com

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.7;

#include "colors.inc"

global_settings { assumed_gamma 1.0 }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare A = 2; // Semi-major axis
#declare B = 1; // semi-minor axis

#declare R = 0.05;
#declare T = 0.20;
#declare D = 0.21;

cylinder {
    -T*y, +T*y, 1
    scale <A, 1, B>
    pigment { color Blue }
}

#declare Nil = 1e-9;
#declare Spline1 =
    spline {
        linear_spline
         0      , <+A, 0,    0>
        10      , <+A, 0, +2*B>
        20 - Nil, <-A, 0, +2*B>
        20      , <-A, 0,   +B>  // or <-A, 0, -B>
        20 + Nil, <-A, 0, -2*B>
        30      , <+A, 0, -2*B>
        40      , <+A, 0,    0>
    }

#declare Spline2 =
    spline {
        linear_spline
         0, <+A, 0, +2*B>
        10, <-A, 0, +2*B>
        20, <-A, 0,    0>
        30, <-A, 0, -2*B>
        40, <+A, 0, -2*B>
    }

#declare Step = 1; // Also try 0.5 and 2
#declare I = 0;
#while (I < 40)
    #declare p1 = Spline1(I);
    #declare p2 = Spline2(I);
    #declare E = (p1.x + A)*p2.z;
    #declare F = (p2.x - A)*p1.z;
    #declare pS = A/(E - F)*<E + F, 0, 2*p1.z*p2.z>;
    cylinder {
        -D*y, +D*y, R
        translate pS
        pigment { color White }
    }
    #declare I = I + Step;
#end // while

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

camera {
    location 4*y
    look_at 0*y
    sky z
}

light_source {
    100*y
    color White
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

From: Thomas de Groot
Subject: Re: HELP - Rotating Railing Posts around Scaled Cylinder Edge
Date: 30 Mar 2018 02:44:48
Message: <5abddce0$1@news.povray.org>
It took me a while to find what I was looking for. I think this would 
help: vaxis_rotate. See test file.

-- 
Thomas


Post a reply to this message


Attachments:
Download 'vaxis_rotate_test.pov.txt' (2 KB)

Goto Latest 10 Messages Next 6 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.