Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Orientation in 2D of a point relative to multiple points

Status
Not open for further replies.

crmaris

Newbie level 1
Newbie level 1
Joined
Apr 13, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
Hello. This is my first post to this community. The problem i face is the follow. I designed a network simulation program in Delphi. Lets say i have a node(root) with two child nodes. When i want to know what child is left and what child is right (i already know the x,y coordinates of the root and two childs) i use the following code in Delphi. My question is how i must change the following code in order to orientate multiple child nodes with reference one root node.Thanks.

function Orientation(x1, y1, x2, y2, Px, Py: Double): Integer;
var
Orin: Double;
begin
(* Linear determinant of the 3 points *)
Orin := (x2 - x1) * (py - y1) - (px - x1) * (y2 - y1);

if Orin > 0.0 then Result := +1 (* Orientaion is to the right-hand side *)
else if Orin < 0.0 then Result := -1 (* Orientaion is to the left-hand side *)
else
Result := 0; (* Orientaion is neutral if result is 0 *)
end;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top