|
|
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
|
|
|
|
Straight lines will cross at one point if their slopes differ.
In an equation of the form y=m*x+b, m is the slope and b the y-intercept.
Where you have two lines y=m1*x+b1, and y=m2*x+b2, you can solve
x=(b1-b2)/(m2-m1) and then subtitute to find y.
A) x=2*y+1 (y=0.5*x-0.5)
B) y=x-1
x = ((-0.5)-(-1))/(1 -0.5) = 0.5/0.5 = 1
y=0.5-0.5=0
In general curved lines are not required to intersect, and if they do
intersect there can be an infinite number of intersections. However, any
two curved lines with a known equations can be tested for intersections
in some interval.
#macro line_intersect_2d(m1 b1 m2 b2)
#if (m1=m2)
#error "There is no intersection!\n"
#else
#local result = <((b1-b2)/(m2-m1)),m1*((b1-b2)/(m2-m1))+b1>;
#end
result
#end
#declare I = line_intersect_2d(0.5, -0.5, 1, -1);
Post a reply to this message
|
|