1
//----------------------------------------------------------------------------
2
// Anti-Grain Geometry - Version 2.4 (Public License)
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5
// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)
6
// Pascal Port By: Milan Marusinec alias Milano
8
// http://www.aggpas.org
9
// Copyright (c) 2005-2006
11
// Permission to copy, use, modify, sell and distribute this software
12
// is granted provided this copyright notice appears in all copies.
13
// This software is provided "as is" without express or implied
14
// warranty, and with no claim as to its suitability for any purpose.
16
//----------------------------------------------------------------------------
17
// Contact: mcseem@antigrain.com
18
// mcseemagg@yahoo.com
19
// http://www.antigrain.com
21
//----------------------------------------------------------------------------
23
// vertex_sequence container and vertex_dist struct
25
// [Pascal Port History] -----------------------------------------------------
27
// 19.12.2005-Milano: Unit port establishment
29
{ agg_vertex_sequence.pas }
43
func_vertex_sequence = function(this ,val : pointer ) : boolean;
45
//----------------------------------------------------------vertex_sequence
46
// Modified agg::pod_deque. The data is interpreted as a sequence of vertices.
47
vertex_sequence_ptr = ^vertex_sequence;
48
vertex_sequence = object(pod_deque )
49
func_operator_vertex_sequence : func_vertex_sequence;
51
constructor Construct(entry_sz : unsigned; s_ : unsigned = 6; fovs : func_vertex_sequence = NIL );
53
procedure add(val : pointer );
55
procedure modify_last(val : pointer);
57
procedure close(remove_flag : boolean );
61
// Coinciding points maximal distance (Epsilon)
63
vertex_dist_epsilon : double = 1e-14;
65
//-------------------------------------------------------------vertex_dist
66
// Vertex (x, y) with the distance to the next one. The last vertex has
67
// distance between the last and the first points if the polygon is closed
68
// and 0.0 if it's a polyline.
70
vertex_dist_ptr = ^vertex_dist;
76
vertex_dist_cmd_ptr = ^vertex_dist_cmd;
77
vertex_dist_cmd = record
85
function vertex_dist_func_operator(this ,val : vertex_dist_ptr ) : boolean;
89
{ LOCAL VARIABLES & CONSTANTS }
93
{ UNIT IMPLEMENTATION }
94
{ FUNC_OPERATOR_VERTEX_DIST }
95
function vertex_dist_func_operator;
100
this.dist:=calc_distance(this.x ,this.y ,val.x ,val.y );
102
ret:=this.dist > vertex_dist_epsilon;
105
this.dist:=1 / vertex_dist_epsilon;
112
constructor vertex_sequence.Construct;
114
inherited Construct(entry_sz ,s_ );
117
func_operator_vertex_sequence:=@vertex_dist_func_operator
119
func_operator_vertex_sequence:=fovs;
124
procedure vertex_sequence.add;
127
if not func_operator_vertex_sequence(
128
array_operator(size - 2 ) ,
129
array_operator(size - 1 ) ) then
137
procedure vertex_sequence.modify_last;
146
procedure vertex_sequence.close;
153
if func_operator_vertex_sequence(
154
array_operator(size - 2 ) ,
155
array_operator(size - 1 ) ) then
158
t:=array_operator(size - 1 );
168
if func_operator_vertex_sequence(
169
array_operator(size - 1 ) ,
170
array_operator(0 ) ) then