i do have two data types tp_point and tp_joint;
With tp_point i may get information such as fld_x and fld_y values as one chunk of data i.e. tp_point(x,y);

Furthermore, tp_joint has two functions one of which does utilise and retrieves tp_point value and another
function func_intersect which finds a point of intersection of two pipe segments;

I do have problems in assigning valuesof tp_point to x1,y1 x2,y2 x3,y3, x4,y4; Any advice you could give to my problem


With regards,



Andrew

P.S. The script iam using looks like this:


create or replace type body tp_joint as
member function func_joint return char is
result char(25);
begin
result:= fld_jointid || ',' || fld_point.func_joint;
return result;
end;
static function func_intersect(fld_pipe1 tp_joint,fld_pipe2 tp_joint) return number is
xc number;
yc number;
r1 number;
s1 number;
t1 number;
r2 number;
s2 number;
t2 number;
x1 number;
y1 number;
x2 number;
y2 number;
x3 number;
y3 number;
x4 number;
y4 number;
xOn boolean;
yOn boolean;
begin

----------------------------------------------------------------------------------------------
--x1:= tp_point.func_x;
--x2:= tp_point.func_x;
--x3:= tp_point.func_x;
--x4:= tp_point.func_x;

--y1:= tp_point.func_y;
--y2:= tp_point.func_y;
--y3:= tp_point.func_y;
--y4:= tp_point.func_y;
----------------------------------------------------------------------------------------------

r1:= (y2 - y1); r2:= (y4 - y3);
s1:= -(x2 - x1); s2:= -(x4 - x3);
t1:= (x2 * y1) - (x1 * y2); t2:= (x4 * y3) - (x3 * y4);

xc:= ((s1 * t2) - (s2 * t1)) / ((s2 * r1) - (s1 * r2));
yc:= ((t1 * r2) - (t2 * r1)) / ((s2 * r1) - (s1 * r2));

xOn:= ((xc >= Least(x1,x2)) and (xc <= Greatest(x1,x2)) and (xc >= Least(x3,x4)) and (xc <= Greatest(x3,x4)));
yOn:= ((yc >= Least(y1,y2)) and (yc <= Greatest(y1,y2)) and (yc >= Least(x3,x4)) and (yc <= Greatest(x3,x4)));

if (xOn and yOn) then
return xc || ',' ||yc;
else
return null;
end if;
end;
end;
/