VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
xyNetworkSegmentMetric.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2001 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: xyNetSegMet.h,v $ $Revision: 1.10 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef xyNetworkSegmentMetric_H_
10 #define xyNetworkSegmentMetric_H_
11 
12 #include "gdb/gdbDefines.h"
13 #include <vlutil/vlNetTypes.h>
15 
16 class DtNetworkSegment;
18 
19 // class DtXyNetworkSegmentMetric:
20 //
21 // DtXyNetworkSegmentMetric is a metric for segments in an mx-cif
22 // quadtree. The metric is based on proximity to a line segment in
23 // projection onto an x-y plane.
24 
26 {
27 public:
28 
29  // default constructor
31 
32  // destructor
33  virtual ~DtXyNetworkSegmentMetric();
34 
35  // copy constructor
37 
38  // assignment operator
40 
41 public:
42 
43  // measure the network segment
44  virtual double measure(const DtNetworkSegment& seg) const;
45 
46  // measure the distance from the test segment
47  virtual double measureDistanceSquaredFromSegment(
48  const DtNetworkSegment& seg) const;
49 
50  // measure the distance along the test segment to the closest point
51  virtual double measureDistanceSquaredAlongSegment(
52  const DtNetworkSegment& seg) const;
53 
54  // validate the network segment
55  virtual bool valid(const DtNetworkSegment& seg) const;
56 
57  // validate the southwest quadrant (closed on southwest side)
58  virtual bool validSW(double xx, double yy) const;
59 
60  // validate the southeast quadrant (closed on southwest side)
61  virtual bool validSE(double xx, double yy) const;
62 
63  // validate the northeast quadrant (closed on southwest side)
64  virtual bool validNE(double xx, double yy) const;
65 
66  // validate the northwest quadrant (closed on southwest side)
67  virtual bool validNW(double xx, double yy) const;
68 
69  // set conditional segment element by element
70  virtual void setX0Y0X1Y1(double x0, double y0, double x1, double y1);
71 
72  // get/set range. If this equals zero, validity checks intersection.
73  // Range should be nonnegative. If maxRange < 0, the range is set to zero.
74  virtual double maxRange() const;
75  virtual void setMaxRange(double maxRange);
76 
77  // get/set flag indicating that the metric measures distance from
78  // the segment. The alternative is to measure distance along the
79  // segment.
80  virtual bool measuresDistanceFromSegment() const;
81  virtual void setMeasuresDistanceFromSegment(bool flag);
82 
83 
84  // Calculates the distance from the conditional segment to the specified
85  // network segment. This method also caclculates the closest point along
86  // the conditional segment and the closest point on the network segment.
87  virtual double distance(const DtNetworkSegment& seg,
88  double& condX,
89  double& condY,
90  double& netX,
91  double& netY);
92  // Same as above, but only calculates the distance between the segments.
93  virtual double distance(const DtNetworkSegment& seg);
94 
95 protected:
96 
97  // quick check using the bounding rectangles for both the network
98  // segment and the conditional segment. Returns false if the two
99  // segments definitely do not intersect. true is inconclusive.
100  virtual bool boundingRectangleTest(const DtNetworkSegment& seg) const;
101 
102  // Calculate if the projections onto the x-y plane of the network segment
103  // and the conditional segment intersect. distanceSquared is the distance
104  // squared between the closest pair of points on the conditional and
105  // network segments.
106  // condX and condY hold the closest conditional-segment points, and netX
107  // and netY hold the closest point on the network segment.
108  virtual bool xyIntersects(const DtNetworkSegment& seg,
109  double& distanceSquared,
110  double& condX,
111  double& condY,
112  double& netX,
113  double& netY) const;
114  // Same as above, but only calculates if an intersection occurs
115  virtual bool xyIntersects(const DtNetworkSegment& seg) const;
116 
117 
118 protected:
119 
120  double myMaxRange;
121  double myX0;
122  double myY0;
123  double myX1;
124  double myY1;
125  double myMinX;
126  double myMinY;
127  double myMaxX;
128  double myMaxY;
129  double myDeltaX;
130  double myDeltaY;
133 };
134 
135 #endif

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)