VR-Forces 4.0.4 Class Documentation
include/gdb/xyNetSegMet.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2001 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: xyNetSegMet.h,v $ $Revision: 1.10 $ $State: Exp $
00007 *********************************************************************/
00008 
00009 #ifndef xyNetSegMet_H_
00010 #define xyNetSegMet_H_
00011 
00012 #include "gdb/gdbDefines.h"
00013 #include <vlutil/vlNetTypes.h>
00014 #include "gdb/netwrkSegMet.h"
00015 
00016 class DtNetworkSegment;
00017 class DtSpecificationAttribute;
00018 
00019 // class DtXyNetworkSegmentMetric:
00020 //
00021 // DtXyNetworkSegmentMetric is a metric for segments in an mx-cif
00022 // quadtree.  The metric is based on proximity to a line segment in 
00023 // projection onto an x-y plane. 
00024 
00025 class DT_DLL_gdb DtXyNetworkSegmentMetric : public DtNetworkSegmentMetric
00026 {
00027 public:
00028 
00029    // default constructor 
00030    DtXyNetworkSegmentMetric();
00031 
00032    // destructor
00033    virtual ~DtXyNetworkSegmentMetric();
00034 
00035    // copy constructor 
00036    DtXyNetworkSegmentMetric(const DtXyNetworkSegmentMetric& orig);
00037 
00038    // assignment operator 
00039    DtXyNetworkSegmentMetric& operator=(const DtXyNetworkSegmentMetric& orig);
00040 
00041 public:
00042 
00043    // measure the network segment
00044    virtual double measure(const DtNetworkSegment& seg) const;
00045 
00046    // measure the distance from the test segment
00047    virtual double measureDistanceSquaredFromSegment(
00048       const DtNetworkSegment& seg) const;
00049 
00050    // measure the distance along the test segment to the closest point
00051    virtual double measureDistanceSquaredAlongSegment(
00052       const DtNetworkSegment& seg) const;
00053 
00054    // validate the network segment
00055    virtual bool valid(const DtNetworkSegment& seg) const;
00056 
00057    // validate the southwest quadrant (closed on southwest side)
00058    virtual bool validSW(double xx, double yy) const;
00059 
00060    // validate the southeast quadrant (closed on southwest side)
00061    virtual bool validSE(double xx, double yy) const;
00062 
00063    // validate the northeast quadrant (closed on southwest side)
00064    virtual bool validNE(double xx, double yy) const;
00065 
00066    // validate the northwest quadrant (closed on southwest side)
00067    virtual bool validNW(double xx, double yy) const;
00068 
00069    // set conditional segment element by element
00070    virtual void setX0Y0X1Y1(double x0, double y0, double x1, double y1);
00071 
00072    // get/set range.  If this equals zero, validity checks intersection.  
00073    // Range should be nonnegative.  If maxRange < 0, the range is set to zero.
00074    virtual double maxRange() const;
00075    virtual void setMaxRange(double maxRange);
00076 
00077    // get/set flag indicating that the metric measures distance from
00078    // the segment.  The alternative is to measure distance along the
00079    // segment.
00080    virtual bool measuresDistanceFromSegment() const;
00081    virtual void setMeasuresDistanceFromSegment(bool flag);
00082 
00083 
00084    // Calculates the distance from the conditional segment to the specified 
00085    // network segment.  This method also caclculates the closest point along 
00086    // the conditional segment and the closest point on the network segment.
00087    virtual double distance(const DtNetworkSegment& seg, 
00088                            double& condX, 
00089                            double& condY, 
00090                            double& netX, 
00091                            double& netY);
00092    // Same as above, but only calculates the distance between the segments.
00093    virtual double distance(const DtNetworkSegment& seg);
00094 
00095 protected:
00096 
00097    // quick check using the bounding rectangles for both the network
00098    // segment and the conditional segment.  Returns false if the two
00099    // segments definitely do not intersect.  true is inconclusive.
00100    virtual bool boundingRectangleTest(const DtNetworkSegment& seg) const;
00101 
00102    // Calculate if the projections onto the x-y plane of the network segment 
00103    // and the conditional segment intersect.  distanceSquared is the distance 
00104    // squared between the closest pair of points on the conditional and 
00105    // network segments.  
00106    // condX and condY hold the closest conditional-segment points, and netX 
00107    // and netY hold the closest point on the network segment.
00108    virtual bool xyIntersects(const DtNetworkSegment& seg,
00109                              double& distanceSquared,
00110                              double& condX, 
00111                              double& condY,
00112                              double& netX, 
00113                              double& netY) const;
00114    // Same as above, but only calculates if an intersection occurs
00115    virtual bool xyIntersects(const DtNetworkSegment& seg) const;
00116 
00117 
00118 protected:
00119 
00120    double             myMaxRange;
00121    double             myX0;
00122    double             myY0;
00123    double             myX1;
00124    double             myY1;
00125    double             myMinX;
00126    double             myMinY;
00127    double             myMaxX;
00128    double             myMaxY;
00129    double             myDeltaX;
00130    double             myDeltaY;
00131    bool               myPositiveFiniteSlope;
00132    bool               myMeasuresDistanceFromSegment;
00133 };
00134 
00135 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)