POV-Ray : Newsgroups : povray.general : trees again : Re: trees again Server Time
29 Jul 2024 20:25:35 EDT (-0400)
  Re: trees again  
From: Anthony D  Baye
Date: 6 Aug 2010 12:10:00
Message: <web.4c5c337361b29a709e1c416d0@news.povray.org>
stbenge <myu### [at] hotmailcom> wrote:
> Anthony D. Baye wrote:
> > Supposing that a tree generation macro took in a location, the age of the tree,
> > and an array of elements to test against, how hard would it be to grow a tree in
> > a given location, accounting for interference from the listed elements?
>
> Testing against a list of successful branch objects and performing
> inside/outside/trace operations on all of them can become very slow.
>
> You may be able to create a 3D array that is the space in which the tree
> grows. Each time a branch is made, fill that part of your 3D array in
> with positive values. Wherever a new branch is supposed to go, test
> against the cells in that area. If the cells are 0, then your branch can
> go there.
>

So, to begin, I would run a sampling loop over the bounding boxes of the target
objects to mark their locations within the 3d-array?

> If you can get away with a low-res array, then this method should be
> pretty fast to compute as you just need to test against (and write to) a
> shared space. But there will be some trickery involved when
> approximating each branch as a voxel representation... To get something
> like this to work, you might want to find out how to make Bresenham
> lines in 3D space, particularly ones with variable padding.
>

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.

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.

It might, actually, be greatly simplified that way.

thoughts?

A.D.B.


Post a reply to this message

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