Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CLineSegment Class Reference

#include <GeoPrimitives.H>

Collaboration diagram for CLineSegment:

Public Member Functions

 CLineSegment ()
 
 CLineSegment (const CPoint &p)
 
 CLineSegment (const CPoint &pb, const CPoint &pe)
 
double length () const
 
CVector slope () const
 
bool has_point (const CPoint &p3) const
 
CPointpoint1 ()
 
CPointpoint2 ()
 
const CPointpoint1 () const
 
const CPointpoint2 () const
 
CLineSegmentpoint1 (const CPoint &p)
 
CLineSegmentpoint2 (const CPoint &p)
 

Protected Attributes

CPoint p1
 
CPoint p2
 

Detailed Description

Definition at line 1059 of file GeoPrimitives.H.

Constructor & Destructor Documentation

CLineSegment ( )
inline

Definition at line 1064 of file GeoPrimitives.H.

1065  : p1(0,0,0),p2(0,0,0)
1066  {};
CLineSegment ( const CPoint p)
inline

Definition at line 1067 of file GeoPrimitives.H.

1068  : p1(0,0,0),p2(p)
1069  {};
CLineSegment ( const CPoint pb,
const CPoint pe 
)
inline

Definition at line 1070 of file GeoPrimitives.H.

1071  : p1(pb),p2(pe)
1072  {};

Member Function Documentation

bool has_point ( const CPoint p3) const
inline

Definition at line 1083 of file GeoPrimitives.H.

References CLine::has_point(), CLineSegment::p1, CLineSegment::p2, CPoint::x(), CPoint::y(), and CPoint::z().

1084  {
1085  if(p3 == p1 || p3 == p2) return true;
1086  if(p1 == p2) return false;
1087  CLine l(p1,p2);
1088  if(!l.has_point(p3)) return false;
1089  double u;
1090  if(p1.x() != p2.x())
1091  u = (p3.x() - p1.x())/(p2.x() - p1.x());
1092  else if(p1.y() != p2.y())
1093  u = (p3.y() - p1.y())/(p2.y() - p1.y());
1094  else if(p1.z() != p2.z())
1095  u = (p3.z() - p1.z())/(p2.z() - p1.z());
1096  return ( u >= 0.0 && u <= 1.0 );
1097  };

Here is the call graph for this function:

double length ( ) const
inline

Definition at line 1073 of file GeoPrimitives.H.

References CVector::norm(), CLineSegment::p1, CLineSegment::p2, and v.

1074  {
1075  CVector v(p1,p2);
1076  return(v.norm());
1077  };
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20

Here is the call graph for this function:

CPoint& point1 ( )
inline

Definition at line 1098 of file GeoPrimitives.H.

References CLineSegment::p1.

1099  {
1100  return (p1);
1101  };
const CPoint& point1 ( ) const
inline

Definition at line 1106 of file GeoPrimitives.H.

References CLineSegment::p1.

1107  {
1108  return (p1);
1109  };
CLineSegment& point1 ( const CPoint p)
inline

Definition at line 1114 of file GeoPrimitives.H.

References CLineSegment::p1.

1115  {
1116  p1 = p;
1117  return(*this);
1118  };
CPoint& point2 ( )
inline

Definition at line 1102 of file GeoPrimitives.H.

References CLineSegment::p2.

1103  {
1104  return (p2);
1105  };
const CPoint& point2 ( ) const
inline

Definition at line 1110 of file GeoPrimitives.H.

References CLineSegment::p2.

1111  {
1112  return (p2);
1113  };
CLineSegment& point2 ( const CPoint p)
inline

Definition at line 1119 of file GeoPrimitives.H.

References CLineSegment::p2.

1120  {
1121  p2 = p;
1122  return(*this);
1123  };
CVector slope ( ) const
inline

Definition at line 1078 of file GeoPrimitives.H.

References CLineSegment::p1, CLineSegment::p2, and v.

1079  {
1080  CVector v(p1,p2);
1081  return(v);
1082  };
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20

Member Data Documentation


The documentation for this class was generated from the following file: