POV-Ray : Newsgroups : povray.general : Bicycle model? : Re: Model Bicycle? ( was Re: Bicycle model?) Server Time
7 Aug 2024 19:23:38 EDT (-0400)
  Re: Model Bicycle? ( was Re: Bicycle model?)  
From: Tor Olav Kristensen
Date: 20 Jul 2001 11:52:16
Message: <3B5853F6.7FDCDCAF@hotmail.com>
Bill DeWitt wrote:
> 
>     Giving up on most of the available models I am attempting to 
> model a bicycle in MegaPov myself using isosurfaces for the frame.
> Unfortunately, my idea about blobbing cylinders is not working too 
> well, because when you create a simple cylinder at an angle, it
> is somewhat flattened in one direction.
> 
>     Is there a good way to rotate a function in isosurfaces before
> you blob it?

Hello Bill,

Making the bicycle frame with an isosurface
is not an easy task, but the code below may
give you some hints.

(Note that I'm not sure if the possibility
to treat functions like I do below was
provided intentionally by the authors of 
MegaPOV.)


Best regards,

-- 
Tor Olav Kristensen
mailto:tor### [at] hotmailcom
http://hjem.sol.no/t-o-k
http://www.crosswinds.net/~tok


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Copyright 2001 by Tor Olav Kristensen
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#version unofficial MegaPov 0.7;

#include "colors.inc"

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

#macro XYZrotFunction(Xrot, Yrot, Zrot)

  function {
    Object(
       (x*cos(Zrot) - y*sin(Zrot))*cos(Yrot) + z*sin(Yrot),
       (x*sin(Zrot) + y*cos(Zrot))*cos(Xrot) + 
     (( x*cos(Zrot) - y*sin(Zrot))*sin(Yrot) - z*cos(Yrot))*sin(Xrot),
       (x*sin(Zrot) + y*cos(Zrot))*sin(Xrot) + 
     ((-x*cos(Zrot) + y*sin(Zrot))*sin(Yrot) + z*cos(Yrot))*cos(Xrot)
    )
  }

#end // macro XrotFunction

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

#declare Sphere = function { sqrt(x^2 + y^2 + z^2) }

#declare RR = 0.25;

//#declare CylinderX = function { Sphere(0, y, z) - RR }
#declare CylinderY = function { Sphere(x, 0, z) - RR }
//#declare CylinderZ = function { Sphere(x, y, 0) - RR }
 
// ===== 1 ======= 3 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#declare Object = function { CylinderY(x, y, z) }

#declare A = pi/4;

#declare RotObject1 = XYZrotFunction(-A,  0,  0)
#declare RotObject2 = XYZrotFunction( 0,  0,  0)
#declare RotObject3 = XYZrotFunction( 0,  0,  A)

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

#declare BlobbingFunction1 =
function {
  RotObject1(x, y, z)*
  RotObject2(x, y, z)*
  RotObject3(x, y, z)
  -0.001
}


/*
#declare Thr = 1/10000;

#declare BlobbingFunction2 =
function {
  1
  -Thr^RotObject1(x, y, z)
  -Thr^RotObject2(x, y, z)
  -Thr^RotObject3(x, y, z)
}
*/


isosurface {
   function {
     BlobbingFunction1(x, y, z)
   }
   method 2
   max_gradient 10
//   accuracy 0.001
   contained_by { sphere { <0, 0, 0>, 3 } }
   pigment { color White }
   finish  { ambient 0.25 }
}
      
// ===== 1 ======= 3 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

light_source {
  <10, 1, 0>*10
  color White
  shadowless
}

background { color Blue/2 }

camera {
  location <2, 3, -3>*2
  look_at <0, 0, 0>
}

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


Post a reply to this message

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