POV-Ray : Newsgroups : povray.newusers : Newbie needs help with first project : Re: Newbie needs help with first project Server Time
5 Oct 2024 15:30:27 EDT (-0400)
  Re: Newbie needs help with first project  
From: Chris B
Date: 11 Oct 2009 03:35:01
Message: <4ad18aa5@news.povray.org>
"Jovian Ghost" <nomail@nomail> wrote in message 
news:web.4ad1312e6c73c7c683b0b960@news.povray.org...
> Thanks for the replies everyone!
>
> I think that using spheres for corners and cylinders for edges is actually 
> a
> good idea, and probably the easiest for me to do. I do believe I may be
> overstepping my bounds a bit.
>
> But I also wanted to try my second idea (actually the link in my second 
> post)
> which is making a spline, then putting spheres that follow that spline. 
> Then
> drawing a cylinder from the top spline to the bottom.
>
> That will work, but unfortunately I can't get my cubic spline to look 
> right, and
> for some crazy reason, POV-Ray only allows Bezier curves for prisms, and 
> not for
> anything else???
>
> Is there an easier way I can model my cubic spline, rather than 
> trial-by-error?
> I tried exporting a spline from Inkscape but unfortunately that only does 
> Bezier
> curves.
>

There is an easy way: There are spline editors available that can directly 
generate cubic splines (e.g. Spilin, which is a small utily application for 
drawing POV-Ray and VRML splines. See 
http://news.povray.org/povray.binaries.utilities/thread/%3C48cf4dea@news.povray.org%3E/).


You can also do the job with Inkscape. It's a little more complex, but if 
you've already got the shape you want in Inkscape, you might want to give 
this a go:
  o  Use the 'edit points' selector in Inkscape to select your shape
  o  Ctrl-A to select all points
  o  Add sufficient intermediary points to the curve so that it won't matter 
what form of spline you eventually use, it'll follow the same path anyway
  o  Save as a POV-Ray prism object
  o  Extract the locations of the points, ignoring the control points

Inkscape writes out the bezier spline with 4 coordinates per line. The outer 
two points are the control points and the inner two points are points on the 
curve. Fortunately it aligns them nicely, making it mind-numbingly easy to 
select columns of data. If you open the file in an editor that supports 
columnar editing you can simply pick out the middle two columns to use, or 
pick out the outer two columns to delete.

In the POV-Ray Windows editor you can use the mouse with Ctrl-Shift to 
select columns of data:
  o  Select the first column of control points and hit delete.
  o  Select that last column of control points and hit delete.
  o  Delete the comma following the last point
  o  Change the spline type to linear
  o  Update the number of control points (halve it)
Hey presto you've got a linear spline that follows your curve and that you 
can easily redefine as a spline function. You can achieve similar results 
using less points by using a cubic spline, but then you'll need to deploy a 
bit of mental effort to add the necessary control points at the start and 
end of the spline.

Note that, when selecting large blocks of data in columns using POV-Ray you 
can click at the start point then use the mouse with the scroll bar to bring 
the end-point into view so that you can Ctrl-Shift-LeftMouseClick it. This 
method of scrolling avoids moving the current position of the caret in the 
text, whereas scrolling using the keyboard moves it, making the whole 
experience less satisfying  :-)

Hope that helps,

Regards,
Chris B.


Post a reply to this message

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