POV-Ray : Newsgroups : povray.general : Perpendicular to an arbitrary axis : Re: Perpendicular to an arbitrary axis Server Time
2 Aug 2024 20:22:19 EDT (-0400)
  Re: Perpendicular to an arbitrary axis  
From: Tor Olav Kristensen
Date: 2 Aug 2004 20:54:37
Message: <410ee24d$1@news.povray.org>
I read your post again.
Now I suspect that you wanted something like this:

Tor Olav

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

#version 3.6;

#include "colors.inc"
#include "math.inc" // For the VPerp_To_Vector() macro

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

#declare NrOfHoles = 6;
#declare OuterRadius = 0.6;
#declare WallThickness = 0.1;
#declare HolesRadius = 0.2;
#declare pSource = <-3, -2, -2>;
#declare pPointAt = <3, 2, 3>;
#declare DistFromSource = 3;

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

#declare InnerRadius = OuterRadius - WallThickness;
#declare vDir = vnormalize(pPointAt - pSource);
#declare vPerp = VPerp_To_Vector(vDir);

difference {
   cylinder {
     pSource, pPointAt, OuterRadius
     pigment { color Yellow }
   }
   cylinder {
     pSource - 0.01*vDir, pPointAt + 0.01*vDir, InnerRadius
     pigment { color Blue*2 }
   }
   #declare Cnt = 0;
   #while (Cnt < NrOfHoles)
     #declare pAround = vaxis_rotate(vPerp, vDir, Cnt/NrOfHoles*360);
     cylinder {
       <0, 0, 0>, pAround + DistFromSource*vDir, HolesRadius
       translate pSource
       pigment { color Red*2 }
     }
     #declare Cnt = Cnt + 1;
   #end // while
}

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

light_source { <3, 6, -4>*10 color White }
light_source { <-3, -6, -8>*10 color White }

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

background { color Grey }

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


Post a reply to this message

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