POV-Ray : Newsgroups : povray.newusers : Simple trig question - what I really want to do Server Time
24 Nov 2024 21:11:55 EST (-0500)
  Simple trig question - what I really want to do (Message 1 to 3 of 3)  
From: TheMightyZog
Subject: Simple trig question - what I really want to do
Date: 13 Jun 2007 15:45:01
Message: <web.46704841aa25d4c0ff6e04e90@news.povray.org>
Perhaps I should explain what I want to do and see if there is a different
solution.

For fun, I'm trying to model a theatre lighting rig.
In this model I position spot lights and point them at particular points

All this is fine, but I thought it would be interesting to show the centre
and edges of the beam by using thin rays (cylinders) as an alternative.

So to simulate

#macro FrontLight(Position,AtX,AtY,AtZ,Colour, BeamSize) //Front Lighting
Bar
light_source
{
      <Position,1.2,-0.6> color Colour * FrontLevel
      spotlight
      radius BeamSize falloff (BeamSize*2)-2
      point_at <AtX,AtY+0.3,AtZ> //stage is 3ft off the ground (.1= 1ft)
      fade_power 2  fade_distance LanteenFadeDistance
      photons { reflection on  refraction on  }
      projected_through{box{<-0.844,0,-0.43>,< 0.844,1.3,2>}} // only point
forwards
      looks_like{Lanteen}
}
#end

I need to construct something like the following

union{
  cylinder{ <0,0,0>,<0,2,0>,0.001 pigment {color Yellow}  //centre of beam
  }
  cylinder{ <0,0,0>,<0,2,0>,0.001 pigment {color Red}
           rotate< -BeamSize,0,0> //to define top edge of beam in Y
  }
  cylinder{ <0,0,0>,<0,2,0>,0.001 pigment {color Green}
           rotate<  BeamSize,0,0> //to define bottom edge of beam in Y
  }
  rotate<Xangle,Yangle,Zangle> //using AtX,AtY,AtZ & Position,1.2,-0.6
  translate<Position,1.2,-0.6>
}

Is this any help?
Zog


Post a reply to this message

From: Alain
Subject: Re: Simple trig question - what I really want to do
Date: 13 Jun 2007 16:47:11
Message: <467057cf@news.povray.org>
TheMightyZog nous apporta ses lumieres en ce 2007/06/13 15:41:
> Perhaps I should explain what I want to do and see if there is a different
> solution.
> 
> For fun, I'm trying to model a theatre lighting rig.
> In this model I position spot lights and point them at particular points
> 
> All this is fine, but I thought it would be interesting to show the centre
> and edges of the beam by using thin rays (cylinders) as an alternative.
> 
> So to simulate
> 
> #macro FrontLight(Position,AtX,AtY,AtZ,Colour, BeamSize) //Front Lighting
> Bar
> light_source
> {
>       <Position,1.2,-0.6> color Colour * FrontLevel
>       spotlight
>       radius BeamSize falloff (BeamSize*2)-2
>       point_at <AtX,AtY+0.3,AtZ> //stage is 3ft off the ground (.1= 1ft)
>       fade_power 2  fade_distance LanteenFadeDistance
>       photons { reflection on  refraction on  }
>       projected_through{box{<-0.844,0,-0.43>,< 0.844,1.3,2>}} // only point
> forwards
>       looks_like{Lanteen}
> }
> #end
> 
> I need to construct something like the following
> 
> union{
>   cylinder{ <0,0,0>,<0,2,0>,0.001 pigment {color Yellow}  //centre of beam
>   }
>   cylinder{ <0,0,0>,<0,2,0>,0.001 pigment {color Red}
>            rotate< -BeamSize,0,0> //to define top edge of beam in Y
>   }
>   cylinder{ <0,0,0>,<0,2,0>,0.001 pigment {color Green}
>            rotate<  BeamSize,0,0> //to define bottom edge of beam in Y
>   }
>   rotate<Xangle,Yangle,Zangle> //using AtX,AtY,AtZ & Position,1.2,-0.6
>   translate<Position,1.2,-0.6>
> }
> 
> Is this any help?
> Zog

Define your light at the origin. Place the point_at relative to that position or 
toward an axis of your choice.
Then:
For the axis of your beam, you can easily define the cylinder as
cylinder{0, PoinatPos, Radius texture{whatever}}
Place the side cylinders starting the same as the center one, using rotate BeamSize.
Make the cylinders finish{ambient 1 diffuse 0} as they won't get light fron the 
spotlight and no_shadow so that they don't cast shadow or the center one will 
blot out your light.
Combine those with the light in an union, or put the cylinders in a looks_like 
block in the light deffinition, and translate it to the final position.
With the looks_like option, there is an implicit no_shadow atribute included.
If you put that deffinition in a #declare, you can then rotate and translate to 
various locations to create several spots.
If you need several different spots, then you can use a
#macro Spot(Radius, Falloff, Color}=...
This will allow you to make spots of various dimention, sharpness and 
coloration, using only one deffinition.

-- 
Alain
-------------------------------------------------
OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime


Post a reply to this message

From: Tim Attwood
Subject: Re: Simple trig question - what I really want to do
Date: 13 Jun 2007 17:32:21
Message: <46706265$1@news.povray.org>
You can avoid most of the math by using...

#include "transforms.inc"
#macro ShowGuide(Position,AtX,AtY,AtZ, BeamSize)
union {
   //centre of beam
   cylinder{ <0,0,0>,<0,2,0>, 0.005
      pigment {color Yellow}
   }
   //to define top edge of beam in Y
   cylinder{ <0,0,0>,<0,2,0>,0.005
      pigment {color Red}
      rotate< -BeamSize,0,0>
   }
   //to define bottom edge of beam in Y
   cylinder{ <0,0,0>,<0,2,0>,0.005
      pigment {color Green}
      rotate<  BeamSize,0,0>
   }
   #local p = <Position,1.2,-0.6>;
   #local pa = <AtX,AtY+0.3,AtZ>;
   #local ny = vnormalize(pa-p);// new up vector
   Point_At_Trans(ny)
   translate p
}
#end


Post a reply to this message

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