Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

|
Options

Kargoneth
2007-08-28 02:27:34

Intriguing... that they are anti-aliased is even more impressive (super-sampling?)

Reminds me of fractals... lol...

I wonder if this kind of stuff could be used to make a crude 'plasma' effect...

How long does it take to render one of those images?

John E. Franklin
2007-08-23 14:39:42

You're a genuous!! Aside from the pun,  what if you set some equations equal to values close to zero, but not exactly, and compare the graphs you get to the zero set equations.
And if they look totally different, then set them even closer to zero until they look similar.

MathsIsFun
2007-08-10 07:20:01

Should be hanging in The Museum of Modern Art!

luca-deltodesco
2007-08-09 22:43:32

my god, this is just plain cool:

http://denvish.net/ulf/090807/49336_laserrend.php

i had to make it render at a higher quality to pick up details:

luca-deltodesco
2007-08-09 22:34:02

yep, there we are:

0.02x³ - 2x² + y² + 2xy - 100 = 0
http://denvish.net/ulf/090807/48838_laserrend.php
----
20cos(0.08y) - 50sin(0.04x) - 0.004xy= 0
http://denvish.net/ulf/090807/48722_laserrend.php
----

http://denvish.net/ulf/090807/48788_laserrend.php

luca-deltodesco
2007-08-09 22:10:32

the narrowing in of boxes looks cool, but the only reason it 'narrows' in is because i am rendering the graphs at different accuracies, it draws a box whenever it detects that the graph passes through it. so having different accuracies, different sized boxes, they congrugate around where the graph parts are drawn

next i need to make it render the shapes as solids, shouldnt be too hard, only a bit of changing to do (have to seperate teh different cases a bit etc, but shouldnt be too hard)

MathsIsFun
2007-08-09 21:57:50

A good technique, a bit like my "brute force" method would you say? But some kind of brute force may be the only way, as the function could pop up anywhere.

The graphs are excellent, I love the "narrowing in" boxes effect, looks very high tech.

luca-deltodesco
2007-08-09 17:59:32

ive figured out a good method that renders the objects perfectly, at arbitrary depth, and works for any implicit function

Basicly: i split the viewing area into equally sized squares.

for each square:

i evaluate the function for each corner, and also whether that point is inside (if the value is less than 0)
if all are inside, or all are outside, i finish here:

then i go through the following 6 cases:

top left is inside ONLY or outside ONLY
top right is inside ONLY or outside ONLY
bottom left is inside ONLY or outside ONLY
bottom right is inside ONLY or outside ONLY
(top is inside AND bottom is outside) OR (top is outside AND bottom is inside)
(left is inside AND right is outside) OR (left is outside AND right is inside)

then for each case, i use the function values to interpolate linearly for where it is assumed f(x,y) would be 0 from the two function values (not perfect, but a good approximation) then same for the other side for whatever case it is, and draw a line.

---------

the red graph is for the square size of 50pixels (pretty terrible)
the green graph is for the square size of 25pixels (not too bad)
the blue graph is for the square size of 10pixels (almost perfect)
the black graph is for teh square size of 5pixels (perfect for all itensive purposes)

----
0.02x³ - 2x² + y² + 2xy - 100 = 0
http://denvish.net/ulf/090807/32088_laser.php
----
20cos(0.08y) - 50sin(0.04x) - 0.004xy= 0
http://denvish.net/ulf/090807/32340_laser.php
----

http://denvish.net/ulf/090807/33048_laser.php

i absolutely adore the second graph, and third graph is just immense

--------

thinking about it, this could be directly extended into 3D aswell, only you would have a few more cases to check for, but otherwise it is directly extendable

Ricky
2007-08-09 10:01:44

You could go about graphing it in 3D, storing only those points which satisfy the requirement = 0.  The important thing when doing this is to build in a "step size" parameter allowing you to get approximations first.

MathsIsFun
2007-08-09 09:26:48

Ideas off the top of my head:

If you could find one point, say (3,4), you could then try small differences to find the next point, and continue that way following the curve in both directions.

To find the first point you could do a "hill climb" (move in the direction that reduces the error the most), or just a brute-force search dividing the space into (say) 1,000 x 1,000, and then narrowing down further as needed.

Continuous functions would be easiest.

luca-deltodesco
2007-08-09 08:03:44

Ive been thinking, how would one go about rendering an implict 2d polynomial graph?

i.e. lets say i have the function:

f(x,y) = 2x^4 - 3x^2y^2 + 2xy - 4x^2 + 5x^3y + 10x + 2 = 0

is there any simple way of being able to render this?

obviously, since its not in the form y = f(x) or x = f(y) i can't just run through values of x,y joining points together, but i know there must be a way, because ive even seen programs that can take implicit functions in 3 dimensions, and render it as a polygonal mesh of arbitrary complexity

---

maybe this would have been better in coders corner, move if appropriate