POV-Ray : Newsgroups : povray.advanced-users : i still do not have an answer yet : Re: i still do not have an answer yet Server Time
29 Jul 2024 20:25:30 EDT (-0400)
  Re: i still do not have an answer yet  
From: Tor Olav Kristensen
Date: 13 Jan 2001 23:16:43
Message: <3A6126E0.F5C4E9DE@online.no>
Adam Gibbons wrote:
> 
> Thanks very much for you help. i have had a kit of usesless replys. 

My opinion is that they weren't useless.

I belive they replied the way they did because you 
asked this kind of question in povray.advanced-users 
instead of in povray.newusers.   ;)


> but yours it very help full.
> 
> i would very much appiciate it if you can provide me with a formula for what
> i have written.

Now it's tomorrow here in Norway and I have had a few beers ...
So therefore I'll not try to give you a lengthy answer now.

But you may have a look at the code below and then feel free 
to ask if you need me to explain more.

Now I'm off to bed.


Regards,

Tor Olav
-- 
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html

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

#version 3.1;

#include "colors.inc"

#declare nothing = 1/10000;

#declare SphereRadius = 0.1;

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Like you did it

sphere {
  <0.68, 0.425/2 + 0.09, 0>, SphereRadius
  translate <0, 0.85, 0>
  scale 0.75
  rotate <10, -45, -20>
  translate <-0.7, -0.1, 0>
  pigment { Red }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Use of vrotate to put sphere in same postion 

#declare pStart = (<0.68, 0.425/2 + 0.09, 0> + <0, 0.85, 0>)*0.75;

#declare pEnd = vrotate(pStart, <10, -45, -20>) + <-0.7, -0.1, 0>;

sphere {
  pEnd, SphereRadius*0.75 // - nothing
  pigment { Yellow }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Doing it the "hard way" with trig functions

#declare pStart = (<0.68, 0.425/2 + 0.09, 0> + <0, 0.85, 0>)*0.75;

#declare xAngle = radians(10);
#declare yAngle = radians(-45);
#declare zAngle = radians(-20);

// Rotate around the x-axis
#declare pRot1 = <pStart.x,
                  cos(xAngle)*pStart.y - sin(xAngle)*pStart.z,
                  cos(xAngle)*pStart.z + sin(xAngle)*pStart.y>;
   
// Rotate around the y-axis
#declare pRot2 = <cos(yAngle)*pRot1.x  + sin(yAngle)*pRot1.z,
                  pRot1.y,
                  cos(yAngle)*pRot1.z  - sin(yAngle)*pRot1.x>

// Rotate around the z-axis
#declare pRot3 = <cos(zAngle)*pRot2.x  - sin(zAngle)*pRot2.y,
                  cos(zAngle)*pRot2.y  + sin(zAngle)*pRot2.x,
                  pRot2.z>

#declare pEnd = pRot3 + <-0.7, -0.1, 0>;

sphere {
  pEnd, SphereRadius*0.75 + nothing
  pigment { Green }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Show start and end postition points in debug window

#macro PrintVector(Vector)

  #debug "<"
  #debug str(Vector.x, 0, -1)
  #debug ", "
  #debug str(Vector.y, 0, -1)
  #debug ", "
  #debug str(Vector.z, 0, -1)
  #debug ">"

#end // macro PrintVector


#debug "\n\n"
PrintVector(pStart)
#debug "\n\n"
PrintVector(pEnd)
#debug "\n\n"

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

light_source { 10*<3, -1, 1> color White }

background { color Blue/2 }

camera {
  location <1, 1, 1>
  look_at <0, 0, 0>
}

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


Post a reply to this message

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