00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // oaSegment.h 00004 // 00005 // This file contains the definition for the oaSegment class. This class 00006 // implements a line segment. 00007 // 00008 // ***************************************************************************** 00009 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00010 // Integration Initiative, this material may not be copied, modified, 00011 // re-published, uploaded, executed, or distributed in any way, in any medium, 00012 // in whole or in part, without prior written permission from Cadence. 00013 // 00014 // Copyright 2002-2005 Cadence Design Systems, Inc. 00015 // All Rights Reserved. 00016 // 00017 // $Author: icftcm $ 00018 // $Revision: #1 $ 00019 // $Date: 2010/08/09 $ 00020 // $State$ 00021 // ***************************************************************************** 00022 // ***************************************************************************** 00023 00024 00025 00026 #if !defined(oaSegment_P) 00027 #define oaSegment_P 00028 00029 00030 00031 // ***************************************************************************** 00032 // Nested includes 00033 // ***************************************************************************** 00034 #include "oaVector.h" 00035 00036 00037 00038 // ***************************************************************************** 00039 // Declare and define types in the OpenAccess namespace. 00040 // ***************************************************************************** 00041 BEGIN_OA_NAMESPACE 00042 00043 00044 00045 // ***************************************************************************** 00046 // Forward Public Class Declarations 00047 // ***************************************************************************** 00048 class oaPoint; 00049 class oaVector; 00050 00051 00052 00053 // ***************************************************************************** 00054 // oaSegment 00055 // ***************************************************************************** 00056 class OA_BASE_DLL_API oaSegment { 00057 public: 00058 oaSegment(); 00059 oaSegment(const oaPoint &headIn, 00060 const oaPoint &tailIn); 00061 oaSegment(const oaVector &vec, 00062 const oaPoint &ref); 00063 00064 oaPoint &head(); 00065 oaPoint &tail(); 00066 oaCoord &x1(); 00067 oaCoord &x2(); 00068 oaCoord &y1(); 00069 oaCoord &y2(); 00070 const oaPoint &head() const; 00071 const oaPoint &tail() const; 00072 oaCoord x1() const; 00073 oaCoord x2() const; 00074 oaCoord y1() const; 00075 oaCoord y2() const; 00076 00077 void set(const oaPoint &head, 00078 const oaPoint &tail); 00079 void set(const oaVector &vec, 00080 const oaPoint &ref); 00081 00082 oaBoolean isHorizontal() const; 00083 oaBoolean isVertical() const; 00084 oaBoolean isOrthogonal() const; 00085 00086 oaOffset getDeltaX() const; 00087 oaOffset getDeltaY() const; 00088 00089 oaDouble distanceFrom2(const oaPoint &point) const; 00090 oaDouble distanceFrom2(const oaPoint &point, 00091 oaPoint &loc) const; 00092 00093 oaBoolean contains(const oaPoint &point, 00094 oaBoolean includeEnds = true) const; 00095 oaBoolean collinearContains(const oaPoint &point, 00096 oaBoolean includeEnds = true) const; 00097 00098 oaBoolean intersects(const oaSegment &seg, 00099 oaBoolean includeEnds = true) const; 00100 oaBoolean intersects(const oaSegment &seg, 00101 oaBoolean includeEnds, 00102 oaBoolean includeOverlap) const; 00103 oaBoolean intersects(const oaSegment &seg, 00104 oaPoint &iPt, 00105 oaBoolean mustIntersect = true) const; 00106 00107 oaBoolean operator==(const oaSegment &segment) const; 00108 oaBoolean operator!=(const oaSegment &segment) const; 00109 00110 private: 00111 oaPoint headVal; 00112 oaPoint tailVal; 00113 }; 00114 00115 00116 00117 END_OA_NAMESPACE 00118 00119 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.