POV-Ray : Newsgroups : povray.general : Algebra in Pov-Ray : Re: Algebra in Pov-Ray Server Time
31 Jul 2024 22:14:04 EDT (-0400)
  Re: Algebra in Pov-Ray  
From: Mike Williams
Date: 27 Jul 2006 08:09:20
Message: <z9F$AAAjyKyEFwfu@econym.demon.co.uk>
Wasn't it Nekar who wrote:
>How can i do this in Pov?
>
>A)  x=2*y + 1
>B) y= x-1

Just to start the ball rolling, but with no expectation of it being a
very practical solution: 

You can set up two functions

#declare fx = function(y){2*y+1}
#declare fy = function(x){x-1}

Then this surface evaluates to a plane which has its x coordinate equal
to the solution.
                   
isosurface {
  function {x-fx(fy(x))} open
  contained_by {box{-3,3}}
  max_gradient 3
  pigment {rgb 1}
}  

You can then trace() that isosurface to obtain the solution for x, then
obtain the y solution from

  #declare y_solution = fy(x_solution);


If your original functions are non-linear, then you can get multiple
planes in the output, one plane for each x_solution.


Unfortunately you won't know how to choose a suitable contained_by
object or max_gradient beforehand.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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