for the time being i wrote it like this:
Code:
type
pnode = ^tnode;
tnode = record
x, y: single;
next: pnode;
prev: pnode;
nextPoly: pnode; // pointer to the next polygon */
neighbor : pnode; // the coresponding intersection point */
intersect: bool; // 1 if an intersection point, 0 otherwise */
entry: bool; // 1 if an entry point, 0 otherwise */
visited: bool; // 1 if the node has been visited, 0 otherwise */
alpha: single; // intersection point placemet */
end;
var
s: pnode;
procedure Add(x,y: single);
var
newnode : pnode;
begin
new(newnode);
newnode.x := x;
newnode.y := y;
newnode.prev := nil; // not need to initialize with 0 after malloc ...
newnode.nextPoly := nil;
newnode.neighbor := nil;
newnode.intersect := false;
newnode.entry := false;
newnode.visited := false;
newnode.alpha := 0.0;
newnode.next := s;
if (s<>nil) then
s.prev := newnode;
s := newnode;
end;
Only to me it seems that prev and next should be named the oposite. e.g. prev should be next and next should be prev?
Bookmarks