POV-Ray : Newsgroups : povray.newusers : Newbie needs help with first project : Re: Newbie needs help with first project Server Time
5 Oct 2024 15:43:23 EDT (-0400)
  Re: Newbie needs help with first project  
From: clipka
Date: 8 Oct 2009 16:10:33
Message: <4ace4739@news.povray.org>
Jovian Ghost schrieb:

> For my first real project, I thought I'd start small, so I decided to do the
> Chevrolet logo. For those of you who don't know, here it is:
> http://questautosale.com/html/chevy_logo.jpg
...
> I'm first starting with the central square. Looks to me like it's a cut-off
> pyramid, so I created a prism with conic_sweep and a bezier_spline profile.
> Works well, but the problem is at the pyramid's cut-off point, the edges are
> sharp. I was wondering how I could smooth these out? I was thinking something
> like a lathe, except instead of revolving around a single axis, revolve around a
> path.

Well, "small" is not always related to actual size: Trying to model 
/anything/ with rounded-off corners is quite an ambitious project to 
start with.

I think Leroy's advice to try modelling it using cylinders for edges, 
spheres for corners, and some "fillings" for the faces, is the easiest 
to go - though I wouldn't recommend triangles, as they behave badly as 
soon as you try to do more sophisticated things with them (like 
difference or intersection CSG), and are probably not much easier to 
compute than boxes or prisms anyway.

To set up prisms for the sides, just generate them as you would for a 
flat 2D variant of the logo, then apply the Shear_Trans() macro from 
transforms.inc to effectively rotate (not shear!) and at the same time 
stretch it; e.g., if your logo is set up with +X = right, +Y = up and +Z 
= camera direction, you could create the "filling" for the right-hand 
side as:

    #include "transforms.inc"

    #declare SideSlope  = 0.5;
    #declare EdgeRadius = 0.1;

    prism {
      linear_spline
      -EdgeRadius, EdgeRadius,
      ...
      [number of points goes here, followed by desired
      X and Y coordinates; don't bother about Z yet]
      ...
      #local NewX = x+SideSlope*z;
      #local NewZ = vnormalize(vcross(NewX,y));
      translate -x*LogoRight
      Shear_Trans(NewX,y,NewZ)
      translate x*LogoRight
    }

The NewX and NewZ vectors are designed to be perpendicular to each other 
and to the Y vector, so the "shearing" transformation is really a 
combination of scaling in what once was the X axis (to compensate for 
the additional depth) followed by a rotation about the Y axis. The prism 
thickness is designed to match edge cylinders of radius "EdgeRadius", 
and the NewZ vector is designed to preserve that thickness; "SideSlope" 
determines how much "depth" the logo will have; in this case, the sides 
will be comparatively "flat" (with an angle of about 27 degrees); a 
value of 1.0 would give you 45 degrees sides. "LogoRight" would be 
whatever point you'd want to keep at Z=0: This might be the edge of the 
front face, the centerline of the sides, or the outer edge of the sides, 
though I guess using the front face edge would be easiest.

Similarly, the top side would be defined as:

    prism {
      linear_spline
      -EdgeRadius, EdgeRadius,
      ...
      [number of points goes here, followed by desired
      X and Y coordinates; don't bother about Z yet]
      ...
      #local NewY = y+SideSlope*z;
      #local NewZ = vnormalize(vcross(x,NewY));
      translate -y*LogoTop
      Shear_Trans(x,NewY,NewZ);
      translate y*LogoTop
    }

Left and bottom would work likewise, except that you'd use 
"-SideSlope*z" instead of "+SideSlope*z".

The front face will not need any transformation I guess, except maybe 
translation to the desired Z coordinate.


Post a reply to this message

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