POV-Ray : Newsgroups : povray.general : trees again : Re: trees again Server Time
29 Jul 2024 20:15:12 EDT (-0400)
  Re: trees again  
From: stbenge
Date: 6 Aug 2010 15:13:27
Message: <4c5c5ed7@news.povray.org>
Anthony D. Baye wrote:
> Thanks for the advice, I'd never heard of Bresenham's algorithm before.  It
> requires bit-shifting, so I'm not sure how an application of this nature would
> work within the confines of the SDL.

You can do almost anything with POV's SDL. The Bresenham algorithm is 
entirely possible.

> Although...
> 
> It might be possible to output a file containing a representation of the csg
> objects in 3d-space (similar to a df3, perhaps.  I'm currently working on a
> program that could do just that using orthogonal slices of an object), which
> could then be read into a 3d array by a secondary utility which would read the
> data into a 3d-array and build the tree as an include file.

Which objects are you testing against? Environmental elements such as 
buildings, which will deflect branches? I guess I was assuming that you 
wanted to keep branches from intersecting other branches. If all you 
want to do is keep branches from intersecting with an environment, then 
your job will be easy(ish), and you won't want to bother with the method 
I previously mentioned.

To detect collisions with an environment, I would definitely use 
trace(). Make the simplest representation of the environment you can, 
and make it a union. You will always test against that union. For each 
new branch, trace() a ray from the beginning of that branch, extending 
out in the direction of growth. If the ray doesn't make contact with the 
environment, make a branch at the full target length. If it does make 
contact, find the length of the ray you just shot and make a branch no 
longer than that length.

> thoughts?

Whichever way is easier for you is the method you want to use :)

Sam


Post a reply to this message

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