cgma
GeomSeg.hpp
Go to the documentation of this file.
00001 //---------------------------------------------
00002 // Class: GeomSeg
00003 // Description: Simple segment class.
00004 // Created by: David R. White
00005 // Date: 7/9/02
00006 //---------------------------------------------
00007 
00008 #ifndef GEOMSEG_HPP
00009 #define GEOMSEG_HPP
00010 
00011 #include "CubitVector.hpp"
00012 #include "CubitBox.hpp"
00013 #include "GeomPoint.hpp"
00014 class RefEntity;
00015 
00016 class GeomSeg
00017 {
00018 private:
00019   RefEntity *myOwner;
00020   GeomSeg *prevSeg, *nextSeg;
00021   GeomPoint *myStart, *myEnd;
00022   CubitBox boundingBox;
00023 public:
00024   GeomSeg( GeomPoint *start, GeomPoint *end, RefEntity *owner );
00025   ~GeomSeg();
00026   CubitBox& bounding_box();
00027   void owner(RefEntity *owner);
00028   RefEntity* owner();
00029   GeomPoint* get_start();
00030   GeomPoint* get_end();
00031   void set_next( GeomSeg *tmp_next);
00032   GeomSeg* get_next();
00033   void set_prev( GeomSeg *tmp_prev);
00034   GeomSeg* get_prev();
00035   
00036 };
00037 inline GeomSeg::GeomSeg( GeomPoint *start,
00038                          GeomPoint *end,
00039                          RefEntity *owner )
00040 {
00041   myOwner = owner;
00042   myStart = start;
00043   myEnd = end;
00044   prevSeg = NULL;
00045   nextSeg = NULL;
00046   CubitVector min, max;
00047   CubitVector p1 = start->coordinates();
00048   CubitVector p2 = end->coordinates();
00049   if ( p1.x() < p2.x() ) {
00050     min.x(p1.x());
00051     max.x(p2.x());
00052   } else {
00053     min.x(p2.x());
00054     max.x(p1.x());
00055   }
00056   if ( p1.y() < p2.y() ) {
00057     min.y(p1.y());
00058     max.y(p2.y());
00059   } else {
00060     min.y(p2.y());
00061     max.y(p1.y());
00062   }
00063   if ( p1.z() < p2.z() ) {
00064     min.z(p1.z());
00065     max.z(p2.z());
00066   } else {
00067     min.z(p2.z());
00068     max.z(p1.z());
00069   }
00070   boundingBox = CubitBox(min, max);
00071 }
00072 inline GeomSeg::~GeomSeg()
00073 {}
00074 inline CubitBox& GeomSeg::bounding_box()
00075 {return boundingBox;}
00076 inline void GeomSeg::owner(RefEntity *owner)
00077 {myOwner = owner;}
00078 inline RefEntity* GeomSeg::owner()
00079 {return myOwner;}
00080 inline GeomPoint* GeomSeg::get_start()
00081 {return myStart;}
00082 inline GeomPoint* GeomSeg::get_end()
00083 {return myEnd;}
00084 inline void GeomSeg::set_next( GeomSeg *tmp_next)
00085 {nextSeg = tmp_next;}
00086 inline GeomSeg* GeomSeg::get_next()
00087 {return nextSeg;}
00088 inline void GeomSeg::set_prev( GeomSeg *tmp_prev)
00089 {prevSeg = tmp_prev;}
00090 inline GeomSeg* GeomSeg::get_prev()
00091 {return prevSeg;}
00092 
00093 
00094 
00095 #endif
00096 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines