Logo by tomot - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. December 02, 2025, 02:38:13 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Can I quickly test if a DE exists inside a cube?  (Read 1074 times)
0 Members and 1 Guest are viewing this topic.
DaveH
Explorer
****
Posts: 57


« on: February 02, 2013, 02:24:27 PM »

Hi, I'm not sure if this is possible but, here goes just in case:  smiley

I'm experimenting with an octree of a DE function like a Mandelbox, and I need to build the tree as efficiently as I can.

Is it possible to find out if a cube is occupied by anything using DE functions? Do I really have step through a cube fractionally to find out if it's occupied? I may miss something doing that, and it's a bit brute force.

The location of any negative DE area doesn't matter at all, I just need to know if a cube is occupied or not.


Thanks,

Dave H.


« Last Edit: February 02, 2013, 02:36:54 PM by DaveH » Logged
eiffie
Guest
« Reply #1 on: February 02, 2013, 05:54:24 PM »

For a sphere it is simple, for a box you would have to test several points and triangulate.
Logged
DaveH
Explorer
****
Posts: 57


« Reply #2 on: February 02, 2013, 06:12:00 PM »

For a sphere it is simple, for a box you would have to test several points and triangulate.

Triangulate? Me-not-understand!  grin
Any small part of the cube could have the DE within it, like a tiny spire shape just poking through the side of the cube needs to be recognised an returning 'occupied' from the algorithm. Is that possible? I don't know how that's done, if at all. embarrass
« Last Edit: February 02, 2013, 06:43:54 PM by DaveH » Logged
DaveH
Explorer
****
Posts: 57


« Reply #3 on: February 02, 2013, 07:01:33 PM »

OK I'm getting there, it's taking me a while to get back into DE functions.
So for a sphere I simply calculate how far the centre of the sphere is from function.
For a cube check, I can test the sphere which intersects the corners of the cube as a quick cull test.
Then do I test the all the corners? I can't figure it out how to do the test.
Can anybody help please?
Logged
Pauldelbrot
Fractal Senior
******
Posts: 2592



pderbyshire2
« Reply #4 on: February 02, 2013, 07:34:52 PM »

A cube of side length x has a corner-to-center distance of sqrt(3*(0.5*x)2) or sqrt(0.75)*x. The cube just fits inside a sphere of that radius with the same center.

So, start by testing the cube's center. If the DE is greater than sqrt(0.75)*x, the cube is empty.

If the cube is not empty, you might try recursively subdividing it into 8 cubes half the size and testing them. Stop the subdivisions when a certain minimum size is reached. For voxel output (for 3D printing) this would be the same everywhere; for generating a 2D image (still or frame of a video) it should probably be larger farther from the camera and smaller closer to it (with some sane cut-off so the thing doesn't freeze or slow to a crawl if the camera bumps into the fractal). However, I'm not sure why you'd want to do this for 2D generation when raymarching works so well.
Logged

eiffie
Guest
« Reply #5 on: February 02, 2013, 08:06:43 PM »

I used the word triangulation loosely. You can determine the position of an object in 3d if you know its distance from 4 non-coplanar points. But now that I think about it you need the EXACT distance not an estimate. I am thinking like Pauldebrot that this will wind up being just as many DE checks. I could see a strategy for CPUs mainly where you start with a DE check on the camera position and then move ALL rays within this radius ahead to meet that sphere. Then branch into quadrants and repeat. That would save DE checks.
Logged
DaveH
Explorer
****
Posts: 57


« Reply #6 on: February 02, 2013, 09:09:34 PM »

Thanks for the useful replies. I wonder how much I'll have to subdivide it for it to be always correct in finding an empty cube? I suppose it depends on the DE function. I'll use a an OpenGL Shader for speed.
So there's no way around the leftover error of the cube/sphere intersection? I'm guessing it probably won't matter in the end as it's telling the truth about the cube being empty because it's inside the sphere!
Subdivision is probable the best way to do it anyhow, as always, it seems. smiley
Thanks again,
Dave H.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Cube guardian Mandelbulb3D Gallery bib 0 1326 Last post August 22, 2010, 12:54:16 AM
by bib
The Cube Mandelbulb3D Gallery Tahyon 0 1048 Last post October 29, 2011, 12:25:10 AM
by Tahyon
This is not a cube Mandelbulb3D Gallery blob 0 822 Last post January 22, 2012, 01:07:41 PM
by blob
The Cube Images Showcase (Rate My Fractal) arias 3 1265 Last post April 28, 2012, 06:10:18 PM
by Dinkydau
Ice Cube Images Showcase (Rate My Fractal) John Smith 1 928 Last post June 05, 2012, 06:34:44 AM
by Pauldelbrot

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.243 seconds with 24 queries. (Pretty URLs adds 0.015s, 2q)