// // $Id: Plane.cpp,v 1.10 2001/02/05 13:52:28 hobbs Exp $ // // File: Plane.cc // Purpose: // Created: 12-SEP-1997 John Hobbs // // $Revision: 1.10 $ // // // Include files #include #include #include using namespace std; using namespace dgs; bool Plane::resize(const double dxhalf, const double dyhalf) // // Purpose: Resize the plane. Does not affect global positions of // dependent geometry structures. // { _xhalf += dxhalf; _yhalf += dyhalf; return true; } SpacePoint Plane::local_to_global(const CartesianCoordinate& lpt) const // // Purpose: // States: // { return GeometryElement::local_to_global(lpt); } MatrixD Plane::local_to_global(const CartesianMatrix& theMatrix) const // // Purpose: Convert the matrix from local to global coordiates // { return GeometryElement::local_to_global(theMatrix); } CartesianCoordinate Plane::global_to_local(const SpacePoint& gpt) const // // Purpose: Convert a global point to its local point representation // States: // { CartesianCoordinate undone = get_position().invert(gpt); //if( undone.z() != 0.0 ) cerr << "Plane::local_to_global. Local coordinate" // << " has non-zero z-component" << endl; return undone; } CartesianCoordinate Plane::xform_to_local(const GeometryXform& xf) const // // Purpose: Convert a (local)transform to local coordinates. Lose the // rotation information. // { return CartesianCoordinate(xf[0],xf[1],0.0); } GeometryXform Plane::local_to_xform(const CartesianCoordinate& lpt) const // // Purpose: Create a transformation describing a point on my surface // { return GeometryXform(lpt.x(),lpt.y(),lpt.z(),0.0,0.0,0.0); } bool Plane::position_child_at(const CartesianCoordinate& lpt, GeometryElement& kid) // // Purpose: // States: // { GeometryXform gxf = local_to_xform(lpt); gxf = get_position().apply(gxf); kid.set_position(gxf); return true; } std::ostream& dgs::operator <<(std::ostream& os, const Plane& me) // // Purpose: Dump the definition of the plane // States: // { os << "Plane, (xlen/2,ylen/2)=(" << me._xhalf << "," << me._yhalf << ") at " << me.get_position(); return os; }