POV-Ray : Newsgroups : povray.binaries.images : Rotating isosurface cylinder Server Time
28 Mar 2024 04:52:26 EDT (-0400)
  Rotating isosurface cylinder (Message 1 to 9 of 9)  
From: StephenS
Subject: Rotating isosurface cylinder
Date: 11 Oct 2016 21:25:39
Message: <57fd9113@news.povray.org>
I can make a sphere where i want;
sqrt(
pow(x-Inside_length,2)
+pow(y-Height+Edge,2)
+pow(z-Edge,2)
)-Block_Round_corner,//sphere outside top

I can rotate the sphere;
//x=x*cos(radians(Angle)) - z*sin(radians(Angle))
//z=x*sin(radians(Angle)) + z*cos(radians(Angle))
//Inside_length=Inside_length*cos(radians(Angle)) - Edge*sin(radians(Angle))
//Edge=Inside_length*sin(radians(Angle)) + Edge*cos(radians(Angle))

sqrt(
pow(x-(Inside_length*cos(radians(-Angle)) - Edge*sin(radians(-Angle))),2)
+pow(y-Height+Edge,2)
+pow(z+(Inside_length*sin(radians(-Angle)) + Edge*cos(radians(-Angle))),2)
)-Block_Round_corner,//sphere outside top

I can make a cylinder;
max(//reference edge good
  sqrt(pow(x-Inside_length,2)+pow(z-Edge,2))-Block_Round_corner,
  y-Height+Edge,
  -y+Edge
)

I can rotate this cylinder, but only on its infinite axis;
max(//rotated edge good
sqrt(
  pow(x-Inside_length*cos(radians(Angle)) - Edge*sin(radians(Angle)),2)
+pow(z-Inside_length*sin(radians(Angle)) + Edge*cos(radians(Angle)),2)
)-Block_Round_corner,
y-Height+Edge,
-y+Edge
)

Now my question;
How do I rotate around y axis
max(//reference edge good
  sqrt(pow(y-Edge,2)+pow(z-Edge,2))-Block_Round_corner,
  x-Inside_length,
  -x+Inside_corner
)
I can substitute my z, but what do I use for my x?


After trying some other stuff, I also have;
sqrt(
  pow(y-Edge,2)
  +pow(z-Edge,2)
 
+pow(x-select(min(x-Inside_length,0),max(x,Inside_corner),min(x,Inside_length)),2)
)-Block_Round_corner

Witch seems to give a cylinder with rounded ends.
I can't seem to rotate this ether.

Suggestions, hints?

First image: my work so far on an isosurface rounded_cylinder_section.
Second image: my cylinder with rounded ends equation.

Stephen S


Post a reply to this message


Attachments:
Download 'stone_blocks_0000.png' (769 KB) Download 'stone_blocks_0002.png' (267 KB)

Preview of image 'stone_blocks_0000.png'
stone_blocks_0000.png

Preview of image 'stone_blocks_0002.png'
stone_blocks_0002.png


 

From: StephenS
Subject: Re: Rotating isosurface cylinder
Date: 11 Oct 2016 21:35:44
Message: <57fd9370@news.povray.org>
...
> First image: my work so far on an isosurface rounded_cylinder_section.
...
I will probably switch to
f_rounded_box(x,y,z, P0, P1, P2, P3)
from functions.inc.
I can rotate and place this, but I would still like to know how to do it 
with a cylinder.

My use of min()/max() in the isosurface causes some artifacts at close 
inspection.

Comments welcome;

Stephen S


Post a reply to this message


Attachments:
Download 'stone_blocks_0001.png' (1389 KB)

Preview of image 'stone_blocks_0001.png'
stone_blocks_0001.png


 

From: scott
Subject: Re: Rotating isosurface cylinder
Date: 12 Oct 2016 03:10:59
Message: <57fde203$1@news.povray.org>
> After trying some other stuff, I also have;
> sqrt(
>  pow(y-Edge,2)
>  +pow(z-Edge,2)
>
> +pow(x-select(min(x-Inside_length,0),max(x,Inside_corner),min(x,Inside_length)),2)
>
> )-Block_Round_corner
>
> Witch seems to give a cylinder with rounded ends.
> I can't seem to rotate this ether.
>
> Suggestions, hints?

To rotate the shape by (eg) 30 degrees about the z axis, you need to 
replace x,y & z in your function with x,y,z rotated by -30 degrees about 
the z axis.

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


Post a reply to this message

From: William F Pokorny
Subject: Re: Rotating isosurface cylinder
Date: 12 Oct 2016 03:51:22
Message: <57fdeb7a$1@news.povray.org>
On 10/11/2016 09:25 PM, StephenS wrote:
...
>
> Now my question;
> How do I rotate around y axis
> max(//reference edge good
>  sqrt(pow(y-Edge,2)+pow(z-Edge,2))-Block_Round_corner,
>  x-Inside_length,
>  -x+Inside_corner
> )
> I can substitute my z, but what do I use for my x?
>
>
> After trying some other stuff, I also have;
> sqrt(
>  pow(y-Edge,2)
>  +pow(z-Edge,2)
>
> +pow(x-select(min(x-Inside_length,0),max(x,Inside_corner),min(x,Inside_length)),2)
>
> )-Block_Round_corner
>
> Witch seems to give a cylinder with rounded ends.
> I can't seem to rotate this ether.
>
> Suggestions, hints?
>
> First image: my work so far on an isosurface rounded_cylinder_section.
> Second image: my cylinder with rounded ends equation.
>
> Stephen S
>
See too:

http://wiki.povray.org/content/Documentation:Tutorial_Section_3.2#Transformations_on_functions

Bill P.


Post a reply to this message

From: William F Pokorny
Subject: Re: Rotating isosurface cylinder
Date: 12 Oct 2016 04:03:32
Message: <57fdee54@news.povray.org>
On 10/11/2016 09:35 PM, StephenS wrote:
> ...
>> First image: my work so far on an isosurface rounded_cylinder_section.
> ...
> I will probably switch to
> f_rounded_box(x,y,z, P0, P1, P2, P3)
> from functions.inc.
> I can rotate and place this, but I would still like to know how to do it
> with a cylinder.
>
> My use of min()/max() in the isosurface causes some artifacts at close
> inspection.
>
> Comments welcome;
>
> Stephen S
>
With min, max I think these sorts of artifacts are always more or less 
there at the threshold-seam between functions. They might or might not 
be seen due AA, application or not of noise/displacement to the 
component functions into max/min, ray direction, etc.

Increasing accuracy (smaller value) in your isosurface sometimes helps.

Using a blobbing function instead of - or in addition to min/max - will 
fix the issue in my experience at the expense of the blobbing.

Bill P.


Post a reply to this message

From: StephenS
Subject: Re: Rotating isosurface cylinder
Date: 12 Oct 2016 06:31:45
Message: <57fe1111$1@news.povray.org>
On 12/10/2016 4:03 AM, William F Pokorny wrote:
...
> With min, max I think these sorts of artifacts are always more or less
> there at the threshold-seam between functions.
...
The rounding is meant to be small, to allow the larger block to stand 
out. It's unlikely to be seen at the scale I intend.

Thanks.

Stephen S


Post a reply to this message

From: StephenS
Subject: Re: Rotating isosurface cylinder
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


 

From: Bald Eagle
Subject: Re: Rotating isosurface cylinder
Date: 12 Oct 2016 10:20:00
Message: <web.57fe45c8d244346db488d9aa0@news.povray.org>
Does this help any?

https://en.wikipedia.org/wiki/Rotation_of_axes


Post a reply to this message

From: StephenS
Subject: Re: Rotating isosurface cylinder
Date: 12 Oct 2016 20:36:11
Message: <57fed6fb$1@news.povray.org>
On 12/10/2016 10:16 AM, Bald Eagle wrote:
> Does this help any?
>
> https://en.wikipedia.org/wiki/Rotation_of_axes

Not so much.

I use the one from the POV-Ray docs, Isosurface tutorial.

However I quickly lose track with all but the simplest equations.

Stephen S


Post a reply to this message

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