POV-Ray : Newsgroups : povray.binaries.images : Rotating isosurface cylinder : Re: Rotating isosurface cylinder Server Time
28 Apr 2024 04:04:29 EDT (-0400)
  Re: Rotating isosurface cylinder  
From: StephenS
Date: 12 Oct 2016 06:48:11
Message: <57fe14eb@news.povray.org>
On 12/10/2016 3:10 AM, scott wrote:
...
> For rotation about z, you need:
>
> ( from https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations )
>
> x' = x*cos(a) - y*sin(a)
> y' = x*sin(a) + y*cos(a)
> z' = z
>
> Putting those into your function above you get something like:
>
> #local a = radians(30);
>
> sqrt(
>  pow((x*sin(a)+y*cos(a))-Edge,2)
>  +pow(z-Edge,2)
>
>
>
+pow((x*cos(a)-y*sin(a))-select(min((x*cos(a)-y*sin(a))-Inside_length,0),max((x*cos(a)-y*sin(a)),Inside_corner),min((x*cos(a)-y*sin(a)),Inside_length)),2)
>
> )-Block_Round_corner
>
sqrt(
  pow(y-Edge,2)

  +pow(x*sin(radians(-Angle)) + z*cos(radians(-Angle))+Edge,2)

  +pow(x*cos(radians(-Angle)) - 
z*sin(radians(-Angle))-select(min(x*cos(radians(-Angle)) - 
z*sin(radians(-Angle))-Inside_length,0),max(x*cos(radians(-Angle)) - 
z*sin(radians(-Angle)),Inside_corner),min(x*cos(radians(-Angle)) - 
z*sin(radians(-Angle)),Inside_length)),2)
                 )-Block_Round_corner,

I though I tried something like this before I posted.
This works. Thanks.

Changes I made:
Angle refers to the final shape, and -Angle is how I get it.
For the z. I changed to +Edge, to line up with the final shape.

Comments welcome;

Stephen S


Post a reply to this message


Attachments:
Download 'stone_blocks_0000.png' (215 KB)

Preview of image 'stone_blocks_0000.png'
stone_blocks_0000.png


 

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