Simbody  3.4 (development)
DecorativeGeometry.h
Go to the documentation of this file.
00001 #ifndef SimTK_SimTKCOMMON_DECORATIVE_GEOMETRY_H_
00002 #define SimTK_SimTKCOMMON_DECORATIVE_GEOMETRY_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                       Simbody(tm): SimTKcommon                             *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK biosimulation toolkit originating from           *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
00011  *                                                                            *
00012  * Portions copyright (c) 2005-13 Stanford University and the Authors.        *
00013  * Authors: Michael Sherman                                                   *
00014  * Contributors: Jack Middleton, Peter Eastman, Ayman Habib                   *
00015  *                                                                            *
00016  * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
00017  * not use this file except in compliance with the License. You may obtain a  *
00018  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
00019  *                                                                            *
00020  * Unless required by applicable law or agreed to in writing, software        *
00021  * distributed under the License is distributed on an "AS IS" BASIS,          *
00022  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
00023  * See the License for the specific language governing permissions and        *
00024  * limitations under the License.                                             *
00025  * -------------------------------------------------------------------------- */
00026 
00030 #include "SimTKcommon/Simmatrix.h"
00031 #include "SimTKcommon/internal/PolygonalMesh.h"
00032 
00033 #include <cassert>
00034 
00035 
00036 namespace SimTK {
00037 
00038 // Some common RGB values;
00039 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Black;   
00040 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Gray;    
00041 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Red;     
00042 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Green;   
00043 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Blue;    
00044 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Yellow;  
00045 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Orange;  
00046 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Magenta; 
00047 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Purple;  
00048 extern SimTK_SimTKCOMMON_EXPORT const Vec3 Cyan;    
00049 extern SimTK_SimTKCOMMON_EXPORT const Vec3 White;   
00050 
00051 // Drawing representations
00052 
00053 class DecorativeGeometryImplementation;
00054 
00086 class SimTK_SimTKCOMMON_EXPORT DecorativeGeometry {
00087 public:
00089 DecorativeGeometry() : rep(0) { }
00090 ~DecorativeGeometry();
00093 DecorativeGeometry(const DecorativeGeometry& source);
00096 DecorativeGeometry& operator=(const DecorativeGeometry& source);
00097 
00099 enum Representation {
00100     DrawPoints    =  1, 
00101     DrawWireframe =  2, 
00102     DrawSurface   =  3, 
00103 
00104     DrawDefault   = -1  
00105 };
00106 
00117 DecorativeGeometry& setBodyId(int bodyId);
00118 
00125 DecorativeGeometry& setIndexOnBody(int index);
00126 
00140 DecorativeGeometry& setUserRef(void* userRef);
00141 
00147 DecorativeGeometry& setTransform(const Transform& X_BG);
00148 
00157 DecorativeGeometry& setResolution(Real);
00158 
00166 DecorativeGeometry& setScaleFactors(const Vec3& scale);
00167 
00169 DecorativeGeometry& setScale(Real scale) {return setScaleFactors(Vec3(scale));}
00170 
00176 int getBodyId() const;
00177 
00182 int getIndexOnBody() const;
00183 
00188 void* getUserRef() const; 
00189 
00192 Real getResolution() const;
00193 
00197 const Transform& getTransform() const;
00198 
00202 const Vec3& getScaleFactors() const;
00203 
00209 DecorativeGeometry& setColor(const Vec3& rgb); // 0-1 for each color
00210 
00214 DecorativeGeometry& setOpacity(Real);          // 0-1; default is 1 (opaque)
00215 
00220 DecorativeGeometry& setLineThickness(Real);
00221 
00224 const Vec3& getColor()      const;
00226 Real getOpacity()    const;
00229 Real getLineThickness() const;
00230     
00235 DecorativeGeometry& setFaceCamera(int shouldFace);
00238 int getFaceCamera() const;
00239 
00243 DecorativeGeometry& setRepresentation(const Representation&);
00244 
00246 Representation getRepresentation() const;
00247 
00248 void implementGeometry(DecorativeGeometryImplementation&) const;
00249 
00250 // Bookkeeping below here -- internal use only. Don't look below or you will
00251 // turn into a pillar of salt.
00252 bool isOwnerHandle() const;
00253 bool isEmptyHandle() const;
00254 explicit DecorativeGeometry(class DecorativeGeometryRep* r) : rep(r) { }
00255 bool hasRep() const {return rep!=0;}
00256 const DecorativeGeometryRep& getRep() const {assert(rep); return *rep;}
00257 DecorativeGeometryRep&       updRep()       {assert(rep); return *rep;}
00258 protected:
00259 DecorativeGeometryRep* rep;
00260 };
00261 
00262 
00267 class SimTK_SimTKCOMMON_EXPORT DecorativePoint : public DecorativeGeometry {
00268 public:
00269     explicit DecorativePoint(const Vec3& p=Vec3(0));
00270 
00271     // These are specific to DecorativePoint.
00272 
00273     DecorativePoint& setPoint(const Vec3& p);
00274     const Vec3& getPoint() const;
00275 
00276     // Retain the derived type when setting generic geometry options.
00277     DecorativePoint& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00278     DecorativePoint& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00279     DecorativePoint& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00280     DecorativePoint& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00281     DecorativePoint& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00282     DecorativePoint& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00283     DecorativePoint& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00284     DecorativePoint& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00285     DecorativePoint& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00286     DecorativePoint& setRepresentation(const Representation& r) 
00287     {   DecorativeGeometry::setRepresentation(r); return *this; }
00288 
00289     SimTK_PIMPL_DOWNCAST(DecorativePoint, DecorativeGeometry);
00290 private:
00291     class DecorativePointRep& updRep();
00292     const DecorativePointRep& getRep() const;
00293 };
00294 
00304 class SimTK_SimTKCOMMON_EXPORT DecorativeLine : public DecorativeGeometry {
00305 public:
00306     explicit DecorativeLine(const Vec3& p1=Vec3(0), const Vec3& p2=Vec3(1)); // line between p1 and p2
00307 
00308     // These are specific to lines.
00309     DecorativeLine& setPoint1(const Vec3& p1);
00310     DecorativeLine& setPoint2(const Vec3& p2);
00311     DecorativeLine& setEndpoints(const Vec3& p1, const Vec3& p2);
00312 
00313     // Retain the derived type when setting generic geometry options.
00314     DecorativeLine& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00315     DecorativeLine& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00316     DecorativeLine& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00317     DecorativeLine& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00318     DecorativeLine& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00319     DecorativeLine& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00320     DecorativeLine& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00321     DecorativeLine& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00322     DecorativeLine& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00323     DecorativeLine& setRepresentation(const Representation& r) 
00324     {   DecorativeGeometry::setRepresentation(r); return *this; }
00325 
00326     const Vec3& getPoint1() const;
00327     const Vec3& getPoint2() const;
00328 
00329     SimTK_PIMPL_DOWNCAST(DecorativeLine, DecorativeGeometry);
00330 private:
00331     class DecorativeLineRep& updRep();
00332     const DecorativeLineRep& getRep() const;
00333 };
00334 
00337 class SimTK_SimTKCOMMON_EXPORT DecorativeCircle : public DecorativeGeometry {
00338 public:
00339     explicit DecorativeCircle(Real radius=0.5);
00340 
00341     DecorativeCircle& setRadius(Real);
00342     Real getRadius() const;
00343 
00344     // Retain the derived type when setting generic geometry options.
00345     DecorativeCircle& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00346     DecorativeCircle& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00347     DecorativeCircle& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00348     DecorativeCircle& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00349     DecorativeCircle& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00350     DecorativeCircle& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00351     DecorativeCircle& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00352     DecorativeCircle& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00353     DecorativeCircle& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00354     DecorativeCircle& setRepresentation(const Representation& r) 
00355     {   DecorativeGeometry::setRepresentation(r); return *this; }
00356 
00357     SimTK_PIMPL_DOWNCAST(DecorativeCircle, DecorativeGeometry);
00358 private:
00359     class DecorativeCircleRep& updRep();
00360     const DecorativeCircleRep& getRep() const;
00361 };
00362 
00365 class SimTK_SimTKCOMMON_EXPORT DecorativeSphere : public DecorativeGeometry {
00366 public:
00367     explicit DecorativeSphere(Real radius=0.5);
00368 
00369     DecorativeSphere& setRadius(Real);
00370     Real getRadius() const;
00371 
00372     // Retain the derived type when setting generic geometry options.
00373     DecorativeSphere& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00374     DecorativeSphere& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00375     DecorativeSphere& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00376     DecorativeSphere& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00377     DecorativeSphere& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00378     DecorativeSphere& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00379     DecorativeSphere& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00380     DecorativeSphere& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00381     DecorativeSphere& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00382     DecorativeSphere& setRepresentation(const Representation& r) 
00383     {   DecorativeGeometry::setRepresentation(r); return *this; }
00384 
00385     SimTK_PIMPL_DOWNCAST(DecorativeSphere, DecorativeGeometry);
00386 private:
00387     class DecorativeSphereRep& updRep();
00388     const DecorativeSphereRep& getRep() const;
00389 };
00390 
00394 class SimTK_SimTKCOMMON_EXPORT DecorativeEllipsoid : public DecorativeGeometry {
00395 public:
00396     explicit DecorativeEllipsoid(const Vec3& radii = 
00397         Vec3(Real(0.5),Real(1/3.),Real(0.25)));
00398 
00399     DecorativeEllipsoid& setRadii(const Vec3&);
00400     const Vec3& getRadii() const;
00401 
00402     // Retain the derived type when setting generic geometry options.
00403     DecorativeEllipsoid& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00404     DecorativeEllipsoid& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00405     DecorativeEllipsoid& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00406     DecorativeEllipsoid& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00407     DecorativeEllipsoid& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00408     DecorativeEllipsoid& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00409     DecorativeEllipsoid& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00410     DecorativeEllipsoid& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00411     DecorativeEllipsoid& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00412     DecorativeEllipsoid& setRepresentation(const Representation& r) 
00413     {   DecorativeGeometry::setRepresentation(r); return *this; }
00414 
00415     SimTK_PIMPL_DOWNCAST(DecorativeEllipsoid, DecorativeGeometry);
00416 private:
00417     class DecorativeEllipsoidRep& updRep();
00418     const DecorativeEllipsoidRep& getRep() const;
00419 };
00420 
00424 class SimTK_SimTKCOMMON_EXPORT DecorativeBrick : public DecorativeGeometry {
00425 public:
00426     explicit DecorativeBrick(const Vec3& halfLengths = Vec3(Real(0.5)));
00427 
00428     DecorativeBrick& setHalfLengths(const Vec3&);
00429     const Vec3& getHalfLengths() const;
00430 
00431     // Retain the derived type when setting generic geometry options.
00432     DecorativeBrick& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00433     DecorativeBrick& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00434     DecorativeBrick& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00435     DecorativeBrick& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00436     DecorativeBrick& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00437     DecorativeBrick& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00438     DecorativeBrick& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00439     DecorativeBrick& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00440     DecorativeBrick& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00441     DecorativeBrick& setRepresentation(const Representation& r) 
00442     {   DecorativeGeometry::setRepresentation(r); return *this; }
00443 
00444     SimTK_PIMPL_DOWNCAST(DecorativeBrick, DecorativeGeometry);
00445 private:
00446     class DecorativeBrickRep& updRep();
00447     const DecorativeBrickRep& getRep() const;
00448 };
00449 
00453 class SimTK_SimTKCOMMON_EXPORT DecorativeCylinder : public DecorativeGeometry {
00454 public:
00455     explicit DecorativeCylinder(Real radius=0.5, Real halfHeight=0.5);
00456 
00457     DecorativeCylinder& setRadius(Real);
00458     DecorativeCylinder& setHalfHeight(Real);
00459     Real getRadius() const;
00460     Real getHalfHeight() const;
00461 
00462     // Retain the derived type when setting generic geometry options.
00463     DecorativeCylinder& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00464     DecorativeCylinder& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00465     DecorativeCylinder& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00466     DecorativeCylinder& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00467     DecorativeCylinder& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00468     DecorativeCylinder& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00469     DecorativeCylinder& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00470     DecorativeCylinder& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00471     DecorativeCylinder& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00472     DecorativeCylinder& setRepresentation(const Representation& r) 
00473     {   DecorativeGeometry::setRepresentation(r); return *this; }
00474 
00475     SimTK_PIMPL_DOWNCAST(DecorativeCylinder, DecorativeGeometry);
00476 private:
00477     class DecorativeCylinderRep& updRep();
00478     const DecorativeCylinderRep& getRep() const;
00479 };
00480 
00484 class SimTK_SimTKCOMMON_EXPORT DecorativeFrame : public DecorativeGeometry {
00485 public:
00486     explicit DecorativeFrame(Real axisLength=1);
00487 
00488     DecorativeFrame& setAxisLength(Real);
00489     Real getAxisLength() const;
00490 
00491     // Retain the derived type when setting generic geometry options.
00492     DecorativeFrame& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00493     DecorativeFrame& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00494     DecorativeFrame& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00495     DecorativeFrame& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00496     DecorativeFrame& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00497     DecorativeFrame& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00498     DecorativeFrame& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00499     DecorativeFrame& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00500     DecorativeFrame& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00501     DecorativeFrame& setRepresentation(const Representation& r) 
00502     {   DecorativeGeometry::setRepresentation(r); return *this; }
00503 
00504     SimTK_PIMPL_DOWNCAST(DecorativeFrame, DecorativeGeometry);
00505 private:
00506     class DecorativeFrameRep& updRep();
00507     const DecorativeFrameRep& getRep() const;
00508 };
00509 
00512 class SimTK_SimTKCOMMON_EXPORT DecorativeText : public DecorativeGeometry {
00513 public:
00514     explicit DecorativeText(const std::string& label="");
00515 
00516     DecorativeText& setText(const std::string& label);
00517     const std::string& getText() const;
00518 
00521     DecorativeText& setIsScreenText(bool isScreen);
00522     bool getIsScreenText() const;
00523 
00524     // Retain the derived type when setting generic geometry options.
00525     DecorativeText& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00526     DecorativeText& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00527     DecorativeText& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00528     DecorativeText& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00529     DecorativeText& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00530     DecorativeText& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00531     DecorativeText& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00532     DecorativeText& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00533     DecorativeText& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00534     DecorativeText& setRepresentation(const Representation& r) 
00535     {   DecorativeGeometry::setRepresentation(r); return *this; }
00536 
00537     SimTK_PIMPL_DOWNCAST(DecorativeText, DecorativeGeometry);
00538 private:
00539     class DecorativeTextRep& updRep();
00540     const DecorativeTextRep& getRep() const;
00541 };
00542 
00545 class SimTK_SimTKCOMMON_EXPORT DecorativeMesh : public DecorativeGeometry {
00546 public:
00547     explicit DecorativeMesh(const PolygonalMesh& mesh);
00548     const PolygonalMesh& getMesh() const;
00549 
00550     // Retain the derived type when setting generic geometry options.
00551     DecorativeMesh& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00552     DecorativeMesh& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00553     DecorativeMesh& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00554     DecorativeMesh& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00555     DecorativeMesh& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00556     DecorativeMesh& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00557     DecorativeMesh& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00558     DecorativeMesh& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00559     DecorativeMesh& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00560     DecorativeMesh& setRepresentation(const Representation& r) 
00561     {   DecorativeGeometry::setRepresentation(r); return *this; }
00562 
00563     SimTK_PIMPL_DOWNCAST(DecorativeMesh, DecorativeGeometry);
00564 private:
00565     class DecorativeMeshRep& updRep();
00566     const DecorativeMeshRep& getRep() const;
00567 };
00568 
00569 
00579 class SimTK_SimTKCOMMON_EXPORT Decorations : public DecorativeGeometry {
00580 public:
00582     Decorations();
00585     explicit Decorations(const DecorativeGeometry& decoration);
00587     Decorations& addDecoration(const DecorativeGeometry& decoration);
00590     Decorations& addDecoration(const Transform& placement,
00591                                const DecorativeGeometry& decoration);
00594     int getNumDecorations() const;
00597     const DecorativeGeometry& getDecoration(int i) const;
00598 
00599     // Retain the derived type when setting generic geometry options.
00600     Decorations& setBodyId(int b)          {DecorativeGeometry::setBodyId(b);        return *this;}
00601     Decorations& setIndexOnBody(int x)     {DecorativeGeometry::setIndexOnBody(x);   return *this;}
00602     Decorations& setUserRef(void* p)       {DecorativeGeometry::setUserRef(p);       return *this;}
00603     Decorations& setTransform(const Transform& X_BD) {DecorativeGeometry::setTransform(X_BD); return *this;}
00604     Decorations& setResolution(Real r)     {DecorativeGeometry::setResolution(r);    return *this;}
00605     Decorations& setScaleFactors(const Vec3& s) {DecorativeGeometry::setScaleFactors(s); return *this;}
00606     Decorations& setColor(const Vec3& rgb) {DecorativeGeometry::setColor(rgb);       return *this;}
00607     Decorations& setOpacity(Real o)        {DecorativeGeometry::setOpacity(o);       return *this;}
00608     Decorations& setLineThickness(Real t)  {DecorativeGeometry::setLineThickness(t); return *this;}
00609     Decorations& setRepresentation(const Representation& r) 
00610     {   DecorativeGeometry::setRepresentation(r); return *this; }
00611 
00612 
00613     SimTK_PIMPL_DOWNCAST(Decorations, DecorativeGeometry);
00614 private:
00615     class DecorationsRep& updRep();
00616     const DecorationsRep& getRep() const;
00617 };
00618 
00621 class SimTK_SimTKCOMMON_EXPORT DecorativeGeometryImplementation {
00622 public:
00623     virtual ~DecorativeGeometryImplementation() { }
00624     virtual void implementPointGeometry(    const DecorativePoint&)    = 0;
00625     virtual void implementLineGeometry(     const DecorativeLine&)     = 0;
00626     virtual void implementBrickGeometry(    const DecorativeBrick&)    = 0;
00627     virtual void implementCylinderGeometry( const DecorativeCylinder&) = 0;
00628     virtual void implementCircleGeometry(   const DecorativeCircle&)   = 0; 
00629     virtual void implementSphereGeometry(   const DecorativeSphere&)   = 0;
00630     virtual void implementEllipsoidGeometry(const DecorativeEllipsoid&)= 0;
00631     virtual void implementFrameGeometry(    const DecorativeFrame&)    = 0;
00632     virtual void implementTextGeometry(     const DecorativeText&)     = 0;
00633     virtual void implementMeshGeometry(     const DecorativeMesh&)     = 0;
00634 };
00635 
00636 } // namespace SimTK
00637 
00638 #endif // SimTK_SimTKCOMMON_DECORATIVE_GEOMETRY_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines