 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Is it a good idea to make stars by using CSG or should they be solid
blocks?
Brendan Ryan
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
It kind of depends on what you are trying to do...
You could use a prism, CSG of a prism, a polygon, a mesh, etc. What are
you trying to accomplish?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I'll try to make solid star prisms if I find out how to move a point
towards the origin.
Brendan Ryan
Andrea Ryan wrote:
> Is it a good idea to make stars by using CSG or should they be solid
> blocks?
> Brendan Ryan
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Andrea Ryan wrote:
> I'll try to make solid star prisms if I find out how to move a point
> towards the origin.
> Brendan Ryan
Multiply the coordinates of your point by the fraction of how much closer
you want the point to be to the origin. For example, if you have a point
<x,y,z> and you want it to be only half as far away from the origin, it's
new coordinate will be .5*<x,y,z>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I tried to divide every other vector by ptmove but it didn't work. This code
rotates and moves the odd numbered points and just rotates the even numbered
points. The code is in a while loop. Rotation_no and point_no both get added
to one at the end.
Brendan Ryan
#local determine = (point_no/2)-int(point_no/2);
#switch (determine)
#case (0.5) //odd numbered point
#local vec =vrotate(<0,1,0>,<0,0,(angle_of_rotation*rotation_no)>/ptmove);
#break
#case (0) //even numbered point
#local vec=vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
#break
#end
Kevin Wampler wrote:
> Andrea Ryan wrote:
>
> > I'll try to make solid star prisms if I find out how to move a point
> > towards the origin.
> > Brendan Ryan
>
> Multiply the coordinates of your point by the fraction of how much closer
> you want the point to be to the origin. For example, if you have a point
> <x,y,z> and you want it to be only half as far away from the origin, it's
> new coordinate will be .5*<x,y,z>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Andrea Ryan wrote:
> I tried to divide every other vector by ptmove but it didn't work. This code
> rotates and moves the odd numbered points and just rotates the even numbered
> points. The code is in a while loop. Rotation_no and point_no both get added
> to one at the end.
> Brendan Ryan
>
> #local determine = (point_no/2)-int(point_no/2);
> #switch (determine)
> #case (0.5) //odd numbered point
> #local vec =vrotate(<0,1,0>,<0,0,(angle_of_rotation*rotation_no)>/ptmove);
> #break
> #case (0) //even numbered point
> #local vec=vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
> #break
> #end
The problem here is that you divided by ptmove within the vrotate() statement.
Change the fourth line to this:
#local vec = vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>)/ptmove;
and it should work.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler wrote:
> The problem here is that you divided by ptmove within the vrotate() statement.
> Change the fourth line to this:
>
> #local vec = vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>)/ptmove;
>
> and it should work.
Or faster:
vrotate(<0, 1/ptmove, 0>, <0,0,angle_of_rotation*rotation_no>);
Jerome
--
*******************************
* Always listen to experts, * Jérôme M. BERGER
* they'll tell you what can't * mailto:ber### [at] iname com
* be done and why... * http://www.enst.fr/~jberger
* Then do it. *
*******************************
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thanks! A five pointed star was rendered! I'll refine the code because the star is
really a decagon. The number of sides a star has is twice the number of points it
has. I'll divide the vector by the distance between the vertex of the decagon and
the midpoint of a pentagon inside the decagon to turn the decagon into a pentagon
with controllable midpoints.
Brendan Ryan
P.S. I call the distance "r" and it is equal to
(tan(180-(90+(180*((2*points)-2))/(2*points)/2)))*(cos(((180*(points-2))/points)/2))
where points is the number of points (the kind that look like arms, not the
vectors) that the star has.
I'll also be posting pictures of stars in the povray.binaries.images group.
Kevin Wampler wrote:
> Andrea Ryan wrote:
>
> > I tried to divide every other vector by ptmove but it didn't work. This code
> > rotates and moves the odd numbered points and just rotates the even numbered
> > points. The code is in a while loop. Rotation_no and point_no both get added
> > to one at the end.
> > Brendan Ryan
> >
> > #local determine = (point_no/2)-int(point_no/2);
> > #switch (determine)
> > #case (0.5) //odd numbered point
> > #local vec =vrotate(<0,1,0>,<0,0,(angle_of_rotation*rotation_no)>/ptmove);
> > #break
> > #case (0) //even numbered point
> > #local vec=vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
> > #break
> > #end
>
> The problem here is that you divided by ptmove within the vrotate() statement.
> Change the fourth line to this:
>
> #local vec = vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>)/ptmove;
>
> and it should work.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I have two pov files with the same contents and they both include the
include file that has the star macro. I can render a image with one of
the files but with the other file, I can't render a image. Both files
have the line
starbl (0,0,0,1,1,1,0,1,5,4)
"starbl" is the macro's name but it says that 'starbl' is an undeclared
identifier.
Thanks.
Brendan Ryan
Andrea Ryan wrote:
> Is it a good idea to make stars by using CSG or should they be solid
> blocks?
> Brendan Ryan
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Is it saved in a different directory? and is your macro file in the include
file and is the include file in your include path?
Andrea Ryan <ary### [at] global2000 net> wrote in message
news:3802395C.D6E626C4@global2000.net...
> I have two pov files with the same contents and they both include the
> include file that has the star macro. I can render a image with one of
> the files but with the other file, I can't render a image. Both files
> have the line
> starbl (0,0,0,1,1,1,0,1,5,4)
> "starbl" is the macro's name but it says that 'starbl' is an undeclared
> identifier.
> Thanks.
> Brendan Ryan
>
> Andrea Ryan wrote:
>
> > Is it a good idea to make stars by using CSG or should they be solid
> > blocks?
> > Brendan Ryan
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
The pov file was saved in a different directory.
Brendan Ryan
Buckaroo Bill wrote:
> Is it saved in a different directory? and is your macro file in the include
> file and is the include file in your include path?
>
> Andrea Ryan <ary### [at] global2000 net> wrote in message
> news:3802395C.D6E626C4@global2000.net...
> > I have two pov files with the same contents and they both include the
> > include file that has the star macro. I can render a image with one of
> > the files but with the other file, I can't render a image. Both files
> > have the line
> > starbl (0,0,0,1,1,1,0,1,5,4)
> > "starbl" is the macro's name but it says that 'starbl' is an undeclared
> > identifier.
> > Thanks.
> > Brendan Ryan
> >
> > Andrea Ryan wrote:
> >
> > > Is it a good idea to make stars by using CSG or should they be solid
> > > blocks?
> > > Brendan Ryan
> >
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Andrea Ryan <ary### [at] global2000 net> wrote in message
news:38024D60.2ADD189B@global2000.net...
> The pov file was saved in a different directory.
> Brendan Ryan
>
Then move a copy of the macro include file to that same directory, or
place the file in your include path.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Brendan Ryan <ary### [at] global2000 net> wrote:
> I tried to divide every other vector by ptmove but it didn't work. This
code
> rotates and moves the odd numbered points and just rotates the even
numbered
> points. The code is in a while loop. Rotation_no and point_no both get
added
> to one at the end.
> Brendan Ryan
>
> #local determine = (point_no/2)-int(point_no/2);
> #switch (determine)
> #case (0.5) file://odd numbered point
> #local vec =vrotate(<0,1,0>,<0,0,(angle_of_rotation*rotation_no)>/ptmove);
> #break
> #case (0) file://even numbered point
> #local vec=vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
> #break
> #end
As Kevin pointed out, what you've divided is the rotation angle, so every
second point will be *rotated* half as much as it should be (still at the
same radius), rather than scaled. Also, the switch you've used is not
necessary, as you can actually use a counter variable that increments in
steps other than 1, eg:
#macro star_prism (Sides, StarFactor, Height1, Height2)
#local RotAngle = 360/Sides;
prism {linear_sweep linear_spline Height1, Height2, Sides+1, x,
#local Count = 0.5; #while (Count < Sides)
vrotate (x/StarFactor, y*RotAngle*Count),
#local Count = Count + 0.5;
vrotate (x, y*RotAngle*Count),
#local Count = Count + 0.5; #end
x}
#end
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Chris Colefax wrote:
>
> As Kevin pointed out, what you've divided is the rotation angle, so every
> second point will be *rotated* half as much as it should be (still at the
> same radius), rather than scaled. Also, the switch you've used is not
> necessary, as you can actually use a counter variable that increments in
> steps other than 1, eg:
>
> #macro star_prism (Sides, StarFactor, Height1, Height2)
> #local RotAngle = 360/Sides;
> prism {linear_sweep linear_spline Height1, Height2, Sides+1, x,
> #local Count = 0.5; #while (Count < Sides)
> vrotate (x/StarFactor, y*RotAngle*Count),
> #local Count = Count + 0.5;
> vrotate (x, y*RotAngle*Count),
> #local Count = Count + 0.5; #end
> x}
> #end
Actually, you could even use directly the angle as a counter, which
should be faster (no multiplication):
#macro star_prism (Sides, StarFactor, Height1, Height2)
#local RotAngle = 180/Sides;
#local EndAngle = 360-RotAngle/2; // to avoid rounding problems
prism {
linear_sweep linear_spline Height1, Height2, Sides+1, x,
#local Angle = 0;
#while (Angle < EndAngle)
vrotate (<1/StarFactor, 0, 0>, <0, Angle, 0>),
#local Angle = Angle + RotAngle;
vrotate (x, <0, Angle, 0>),
#local Count = Angle + RotAngle;
#end
x
}
#end
Jerome
--
*******************************
* Always listen to experts, * Jérôme M. BERGER
* they'll tell you what can't * mailto:ber### [at] iname com
* be done and why... * http://www.enst.fr/~jberger
* Then do it. *
*******************************
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I just replaced the #switch statement with a #if statement and changed a few
other things like how the rotation angle is defined. POV-Ray was complaining
about the commas at the end of the vrotate functions in the macros below this
message.
Brendan Ryan
"Jerome M. BERGER" wrote:
> Chris Colefax wrote:
> >
> > As Kevin pointed out, what you've divided is the rotation angle, so every
> > second point will be *rotated* half as much as it should be (still at the
> > same radius), rather than scaled. Also, the switch you've used is not
> > necessary, as you can actually use a counter variable that increments in
> > steps other than 1, eg:
> >
> > #macro star_prism (Sides, StarFactor, Height1, Height2)
> > #local RotAngle = 360/Sides;
> > prism {linear_sweep linear_spline Height1, Height2, Sides+1, x,
> > #local Count = 0.5; #while (Count < Sides)
> > vrotate (x/StarFactor, y*RotAngle*Count),
> > #local Count = Count + 0.5;
> > vrotate (x, y*RotAngle*Count),
> > #local Count = Count + 0.5; #end
> > x}
> > #end
> Actually, you could even use directly the angle as a counter, which
> should be faster (no multiplication):
>
> #macro star_prism (Sides, StarFactor, Height1, Height2)
> #local RotAngle = 180/Sides;
> #local EndAngle = 360-RotAngle/2; // to avoid rounding problems
> prism {
> linear_sweep linear_spline Height1, Height2, Sides+1, x,
> #local Angle = 0;
> #while (Angle < EndAngle)
> vrotate (<1/StarFactor, 0, 0>, <0, Angle, 0>),
> #local Angle = Angle + RotAngle;
> vrotate (x, <0, Angle, 0>),
> #local Count = Angle + RotAngle;
> #end
> x
> }
> #end
>
> Jerome
>
> --
> *******************************
> * Always listen to experts, * Jérôme M. BERGER
> * they'll tell you what can't * mailto:ber### [at] iname com
> * be done and why... * http://www.enst.fr/~jberger
> * Then do it. *
> *******************************
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |