<NME> WrapTorus.h
<BEF> #ifndef OPENSIM_WRAP_TORUS_H_
#define OPENSIM_WRAP_TORUS_H_
/* -------------------------------------------------------------------------- *
 *                           OpenSim:  WrapTorus.h                            *
 * -------------------------------------------------------------------------- *
 * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *
 * See http://opensim.stanford.edu and the NOTICE file for more information.  *
 * OpenSim is developed at Stanford University and supported by the US        *
 * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *
 * through the Warrior Web program.                                           *
 *                                                                            *
 * Copyright (c) 2005-2019 Stanford University and the Authors                *
 * Author(s): Peter Loan                                                      *
 *                                                                            *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
 * not use this file except in compliance with the License. You may obtain a  *
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
 *                                                                            *
 * Unless required by applicable law or agreed to in writing, software        *
 * distributed under the License is distributed on an "AS IS" BASIS,          *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
 * See the License for the specific language governing permissions and        *
 * limitations under the License.                                             *
 * -------------------------------------------------------------------------- */


// INCLUDE
#include "WrapObject.h"
#include <string>
#include <OpenSim/Simulation/osimSimulationDLL.h>
#include <OpenSim/Common/Object.h>
#include <OpenSim/Common/VisibleObject.h>
#include <OpenSim/Common/PropertyDbl.h>
#include "WrapObject.h"

namespace OpenSim {

class VisibleObject;
class Body;
class Model;
class PathPoint;
 * @author Peter Loan  
 * updated for OpenSim 4.0 by Benjamin Michaud, 2019.
 */
class OSIMSIMULATION_API WrapTorus : public WrapObject {
OpenSim_DECLARE_CONCRETE_OBJECT(WrapTorus, WrapObject);

private:
    struct CircleCallback {
        double p1[3], p2[3], r;
    };

public:
//==============================================================================
// PROPERTIES
//==============================================================================
    OpenSim_DECLARE_PROPERTY(inner_radius, double, "The inner radius of the Torus.");
    OpenSim_DECLARE_PROPERTY(outer_radius, double, "The outer radius of the Torus.");

//=============================================================================
// METHODS
//=============================================================================
    //--------------------------------------------------------------------------
    // CONSTRUCTION
    //--------------------------------------------------------------------------
public:
    WrapTorus();
    virtual ~WrapTorus();

    const char* getWrapTypeName() const override;
    std::string getDimensionsString() const override;
    SimTK::Real getInnerRadius() const;
    SimTK::Real getOuterRadius() const;

    /** Scale the torus's dimensions. The base class (WrapObject) scales the
        origin of the torus in the body's reference frame. */
    void extendScale(const SimTK::State& s, const ScaleSet& scaleSet) override;

protected:
    int wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,
        const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const override;

    /// Implement generateDecorations to draw geometry in visualizer
    void generateDecorations(bool fixed, const ModelDisplayHints& hints, const SimTK::State& state,
        SimTK::Array_<SimTK::DecorativeGeometry>& appendToThis) const override;

    void extendFinalizeFromProperties() override;

private:
    void constructProperties();

    int findClosestPoint(double radius, double p1[], double p2[],
        double* xc, double* yc, double* zc,
        int wrap_sign, int wrap_axis) const;
    static void calcCircleResids(int numResid, int numQs, double q[],
        double resid[], int *flag2, void *ptr);

//=============================================================================
};  // END of class WrapTorus
//=============================================================================
//=============================================================================

} // end of namespace OpenSim

#endif // OPENSIM_WRAP_TORUS_H_



<MSG> First commit to Geometry refactoring. Remove VisibleObject, DisplayGeometry and GeometrySet and all references to them. All test cases pass.

Conflicts:
	Applications/Scale/scale.cpp
	OpenSim/Actuators/McKibbenActuator.h
	OpenSim/Actuators/Test/testMuscles.cpp
	OpenSim/Common/DisplayGeometry.cpp
	OpenSim/Common/DisplayGeometry.h
	OpenSim/Common/Geometry.h
	OpenSim/Common/GeometrySet.h
	OpenSim/Common/Object.h
	OpenSim/Common/RegisterTypes_osimCommon.cpp
	OpenSim/Common/VisibleObject.cpp
	OpenSim/Common/VisibleObject.h
	OpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp
	OpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp
	OpenSim/Simulation/Model/ContactGeometry.cpp
	OpenSim/Simulation/Model/ContactGeometry.h
	OpenSim/Simulation/Model/ContactHalfSpace.cpp
	OpenSim/Simulation/Model/ContactMesh.cpp
	OpenSim/Simulation/Model/ContactSphere.cpp
	OpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp
	OpenSim/Simulation/Model/ExpressionBasedBushingForce.h
	OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp
	OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h
	OpenSim/Simulation/Model/FunctionBasedBushingForce.cpp
	OpenSim/Simulation/Model/FunctionBasedBushingForce.h
	OpenSim/Simulation/Model/GeometryPath.cpp
	OpenSim/Simulation/Model/GeometryPath.h
	OpenSim/Simulation/Model/Ligament.cpp
	OpenSim/Simulation/Model/Ligament.h
	OpenSim/Simulation/Model/ModelVisualizer.cpp
	OpenSim/Simulation/Model/PathActuator.cpp
	OpenSim/Simulation/Model/PathActuator.h
	OpenSim/Simulation/Model/PathPoint.cpp
	OpenSim/Simulation/Model/PathPoint.h
	OpenSim/Simulation/Model/PathSpring.cpp
	OpenSim/Simulation/Model/PathSpring.h
	OpenSim/Simulation/Model/PointToPointSpring.cpp
	OpenSim/Simulation/Model/PointToPointSpring.h
	OpenSim/Simulation/SimbodyEngine/Body.cpp
	OpenSim/Simulation/SimbodyEngine/Body.h
	OpenSim/Simulation/Test/testProbes.cpp
	OpenSim/Simulation/Wrap/WrapCylinder.cpp
	OpenSim/Simulation/Wrap/WrapCylinderObst.cpp
	OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp
	OpenSim/Simulation/Wrap/WrapEllipsoid.cpp
	OpenSim/Simulation/Wrap/WrapObject.cpp
	OpenSim/Simulation/Wrap/WrapObject.h
	OpenSim/Simulation/Wrap/WrapSphere.cpp
	OpenSim/Simulation/Wrap/WrapSphereObst.cpp
	OpenSim/Simulation/Wrap/WrapTorus.cpp
	OpenSim/Wrapping/Python/OpenSimContext.h

Conflicts:
	OpenSim/Actuators/Test/testMuscles.cpp
	OpenSim/Common/Object.h
	OpenSim/Common/RegisterTypes_osimCommon.cpp
	OpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp
	OpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp
	OpenSim/Simulation/Model/ContactGeometry.cpp
	OpenSim/Simulation/Model/ContactGeometry.h
	OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp
	OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h
	OpenSim/Simulation/Model/FunctionBasedBushingForce.cpp
	OpenSim/Simulation/Model/FunctionBasedBushingForce.h
	OpenSim/Simulation/Model/GeometryPath.h
	OpenSim/Simulation/Model/PathActuator.cpp
	OpenSim/Simulation/Model/PathActuator.h
	OpenSim/Simulation/Model/PathPoint.cpp
	OpenSim/Simulation/Model/PathPoint.h
	OpenSim/Simulation/Model/PointToPointSpring.cpp
	OpenSim/Simulation/Model/PointToPointSpring.h
	OpenSim/Simulation/SimbodyEngine/Body.cpp
	OpenSim/Simulation/SimbodyEngine/Body.h
	OpenSim/Simulation/Wrap/WrapObject.cpp
	OpenSim/Simulation/Wrap/WrapObject.h

<DFF> @@ -29,13 +29,11 @@
 #include <string>
 #include <OpenSim/Simulation/osimSimulationDLL.h>
 #include <OpenSim/Common/Object.h>
-#include <OpenSim/Common/VisibleObject.h>
 #include <OpenSim/Common/PropertyDbl.h>
 #include "WrapObject.h"
 
 namespace OpenSim {
 
-class VisibleObject;
 class Body;
 class Model;
 class PathPoint;

{'commit': 'diff --git a/Applications/Scale/scale.cpp b/Applications/Scale/scale.cpp\nindex 3367407d5..8c7e31dc1 100644\n--- a/Applications/Scale/scale.cpp\n+++ b/Applications/Scale/scale.cpp\n@@ -50,114 +50,113 @@ static void PrintUsage(const char *aProgName, ostream &aOStream);\n */\n int main(int argc,char **argv)\n {\n-    //TODO: put these options on the command line\n-    //LoadOpenSimLibrary("osimSimbodyEngine");\n-\n-    // SET OUTPUT FORMATTING\n-    IO::SetDigitsPad(4);\n-\n-    // REGISTER TYPES\n-    Object::registerType(VisibleObject());\n-    Object::registerType(ScaleTool());\n-    ScaleTool::registerTypes();\n-\n-    // PARSE COMMAND LINE\n-    string inName;\n-    string option = "";\n-    if (argc < 2) {\n-        PrintUsage(argv[0], cout);\n-        exit(-1);\n-    } else {\n-        // Load libraries first\n-        LoadOpenSimLibraries(argc,argv);\n-        int i;\n-        for(i=1;i<=(argc-1);i++) {\n-            option = argv[i];\n-\n-            // PRINT THE USAGE OPTIONS\n-            if((option=="-help")||(option=="-h")||(option=="-Help")||(option=="-H")||\n-                (option=="-usage")||(option=="-u")||(option=="-Usage")||(option=="-U")) {\n-                    PrintUsage(argv[0], cout);\n-                    return(0);\n-\n-                // Identify the setup file\n-                } else if((option=="-S")||(option=="-Setup")) {\n-                    if (argv[i+1]==0){\n-                        PrintUsage(argv[0], cout);\n-                        return(0);\n-                    }\n-                    inName = argv[i+1];\n-                    break;\n-\n-                // Print a default setup file\n-                } else if((option=="-PrintSetup")||(option=="-PS")) {\n-                    ScaleTool *subject = new ScaleTool();\n-                    subject->setName("default");\n-                    // Add in useful objects that may need to be instantiated\n-                    Object::setSerializeAllDefaults(true);\n-                    subject->print("default_Setup_Scale.xml");\n-                    Object::setSerializeAllDefaults(false);\n-                    cout << "Created file default_Setup_Scale.xml with default setup" << endl;\n-                    return(0);\n-\n-                // PRINT PROPERTY INFO\n-                } else if((option=="-PropertyInfo")||(option=="-PI")) {\n-                    if((i+1)>=argc) {\n-                        Object::PrintPropertyInfo(cout,"");\n-\n-                    } else {\n-                        char *compoundName = argv[i+1];\n-                        if(compoundName[0]==\'-\') {\n-                            Object::PrintPropertyInfo(cout,"");\n-                        } else {\n-                            Object::PrintPropertyInfo(cout,compoundName);\n-                        }\n-                    }\n-                    return(0);\n-\n-                // Unrecognized\n-                } else {\n-                    cout << "Unrecognized option " << option << " on command line... Ignored" << endl;\n-                    PrintUsage(argv[0], cout);\n-                    return(0);\n-                }\n-        }\n-    }\n-\n-\n-    try {\n-        // Construct model and read parameters file\n-        ScaleTool* subject = new ScaleTool(inName);\n-        Model* model = subject->createModel();\n-\n-        if(!model) throw Exception("scale: ERROR- No model specified.",__FILE__,__LINE__);\n-\n-        if (!subject->isDefaultModelScaler() && subject->getModelScaler().getApply())\n-        {\n-            ModelScaler& scaler = subject->getModelScaler();\n+\t//TODO: put these options on the command line\n+\t//LoadOpenSimLibrary("osimSimbodyEngine");\n+\n+\t// SET OUTPUT FORMATTING\n+\tIO::SetDigitsPad(4);\n+\n+\t// REGISTER TYPES\n+\tObject::registerType(ScaleTool());\n+\tScaleTool::registerTypes();\n+\n+\t// PARSE COMMAND LINE\n+\tstring inName;\n+\tstring option = "";\n+\tif (argc < 2) {\n+\t\tPrintUsage(argv[0], cout);\n+\t\texit(-1);\n+\t} else {\n+\t\t// Load libraries first\n+\t\tLoadOpenSimLibraries(argc,argv);\n+\t\tint i;\n+\t\tfor(i=1;i<=(argc-1);i++) {\n+\t\t\toption = argv[i];\n+\n+\t\t\t// PRINT THE USAGE OPTIONS\n+\t\t\tif((option=="-help")||(option=="-h")||(option=="-Help")||(option=="-H")||\n+\t\t\t\t(option=="-usage")||(option=="-u")||(option=="-Usage")||(option=="-U")) {\n+\t\t\t\t\tPrintUsage(argv[0], cout);\n+\t\t\t\t\treturn(0);\n+\n+\t\t\t\t// Identify the setup file\n+\t\t\t\t} else if((option=="-S")||(option=="-Setup")) {\n+\t\t\t\t\tif (argv[i+1]==0){\n+\t\t\t\t\t\tPrintUsage(argv[0], cout);\n+\t\t\t\t\t\treturn(0);\n+\t\t\t\t\t}\n+\t\t\t\t\tinName = argv[i+1];\n+\t\t\t\t\tbreak;\n+\n+\t\t\t\t// Print a default setup file\n+\t\t\t\t} else if((option=="-PrintSetup")||(option=="-PS")) {\n+\t\t\t\t\tScaleTool *subject = new ScaleTool();\n+\t\t\t\t\tsubject->setName("default");\n+\t\t\t\t\t// Add in useful objects that may need to be instantiated\n+\t\t\t\t\tObject::setSerializeAllDefaults(true);\n+\t\t\t\t\tsubject->print("default_Setup_Scale.xml");\n+\t\t\t\t\tObject::setSerializeAllDefaults(false);\n+\t\t\t\t\tcout << "Created file default_Setup_Scale.xml with default setup" << endl;\n+\t\t\t\t\treturn(0);\n+\n+\t\t\t\t// PRINT PROPERTY INFO\n+\t\t\t\t} else if((option=="-PropertyInfo")||(option=="-PI")) {\n+\t\t\t\t\tif((i+1)>=argc) {\n+\t\t\t\t\t\tObject::PrintPropertyInfo(cout,"");\n+\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tchar *compoundName = argv[i+1];\n+\t\t\t\t\t\tif(compoundName[0]==\'-\') {\n+\t\t\t\t\t\t\tObject::PrintPropertyInfo(cout,"");\n+\t\t\t\t\t\t} else {\n+\t\t\t\t\t\t\tObject::PrintPropertyInfo(cout,compoundName);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t}\n+\t\t\t\t\treturn(0);\n+\n+\t\t\t\t// Unrecognized\n+\t\t\t\t} else {\n+\t\t\t\t\tcout << "Unrecognized option " << option << " on command line... Ignored" << endl;\n+\t\t\t\t\tPrintUsage(argv[0], cout);\n+\t\t\t\t\treturn(0);\n+\t\t\t\t}\n+\t\t}\n+\t}\n+\n+\n+\ttry {\n+\t\t// Construct model and read parameters file\n+\t\tScaleTool* subject = new ScaleTool(inName);\n+\t\tModel* model = subject->createModel();\n+\n+\t\tif(!model) throw Exception("scale: ERROR- No model specified.",__FILE__,__LINE__);\n+\n+\t\tif (!subject->isDefaultModelScaler() && subject->getModelScaler().getApply())\n+\t\t{\n+\t\t\tModelScaler& scaler = subject->getModelScaler();\n             if(!scaler.processModel(model, subject->getPathToSubject(), subject->getSubjectMass())) return 1;\n-        }\n-        else\n-        {\n-            cout << "Scaling parameters disabled (apply is false) or not set. Model is not scaled." << endl;\n-        }\n-        \n-        if (!subject->isDefaultMarkerPlacer())\n-        {\n-            MarkerPlacer& placer = subject->getMarkerPlacer();\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tcout << "Scaling parameters disabled (apply is false) or not set. Model is not scaled." << endl;\n+\t\t}\n+\t\t\n+\t\tif (!subject->isDefaultMarkerPlacer())\n+\t\t{\n+\t\t\tMarkerPlacer& placer = subject->getMarkerPlacer();\n             if(!placer.processModel(model, subject->getPathToSubject())) return 1;\n-        }\n-        else\n-        {\n-            cout << "Marker placement parameters disabled (apply is false) or not set. No markers have been moved." << endl;\n-        }\n-\n-        delete model;\n-        delete subject;\n-    }\n-    catch(const Exception& x) {\n-        x.print(cout);\n-    }\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tcout << "Marker placement parameters disabled (apply is false) or not set. No markers have been moved." << endl;\n+\t\t}\n+\n+\t\tdelete model;\n+\t\tdelete subject;\n+\t}\n+\tcatch(const Exception& x) {\n+\t\tx.print(cout);\n+\t}\n \n }\n \n@@ -167,13 +166,13 @@ int main(int argc,char **argv)\n */\n void PrintUsage(const char *aProgName, ostream &aOStream)\n {\n-    string progName=IO::GetFileNameFromURI(aProgName);\n-    aOStream<<"\\n\\n"<<progName<<":\\n"<<GetVersionAndDate()<<"\\n\\n";\n-    aOStream<<"Option            Argument          Action / Notes\\n";\n-    aOStream<<"------            --------          --------------\\n";\n-    aOStream<<"-Help, -H                           Print the command-line options for "<<progName<<".\\n";\n-    aOStream<<"-PrintSetup, -PS                    Generates a template Setup file to customize scaling\\n";\n-    aOStream<<"-Setup, -S        SetupFileName     Specify an xml setup file for scaling a generic model.\\n";\n-    aOStream<<"-PropertyInfo, -PI                  Print help information for properties in setup files.\\n";\n+\tstring progName=IO::GetFileNameFromURI(aProgName);\n+\taOStream<<"\\n\\n"<<progName<<":\\n"<<GetVersionAndDate()<<"\\n\\n";\n+\taOStream<<"Option            Argument          Action / Notes\\n";\n+\taOStream<<"------            --------          --------------\\n";\n+\taOStream<<"-Help, -H                           Print the command-line options for "<<progName<<".\\n";\n+\taOStream<<"-PrintSetup, -PS                    Generates a template Setup file to customize scaling\\n";\n+\taOStream<<"-Setup, -S        SetupFileName     Specify an xml setup file for scaling a generic model.\\n";\n+\taOStream<<"-PropertyInfo, -PI                  Print help information for properties in setup files.\\n";\n \n }\ndiff --git a/OpenSim/Actuators/McKibbenActuator.h b/OpenSim/Actuators/McKibbenActuator.h\nindex 4ad389f86..e4a7b51e6 100644\n--- a/OpenSim/Actuators/McKibbenActuator.h\n+++ b/OpenSim/Actuators/McKibbenActuator.h\n@@ -59,73 +59,70 @@ public:\n     /** @name Property declarations \n     These are the serializable properties associated with this class. **/\n     /**@{**/\n-    OpenSim_DECLARE_PROPERTY(thread_length, double,\n-        "The thread length");\n-    OpenSim_DECLARE_PROPERTY(number_of_turns, double,\n-        "Number of turns of the thread.");\n-    OpenSim_DECLARE_PROPERTY(cord_length, double,\n+\tOpenSim_DECLARE_PROPERTY(thread_length, double,\n+\t\t"The thread length");\n+\tOpenSim_DECLARE_PROPERTY(number_of_turns, double,\n+\t\t"Number of turns of the thread.");\n+\tOpenSim_DECLARE_PROPERTY(cord_length, double,\n         "The length of the flexible cord attaching the actuator to the last point.");\n-    /**@}**/\n-    \n+\t/**@}**/\n+\t\n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    /** Default constructor leaves body names unspecified. **/\n+\t/** Default constructor leaves body names unspecified. **/\n     McKibbenActuator();\n-    /** Convenience constructor for API users. **/\n-    McKibbenActuator(const std::string& name, double num_turns, double thread_length);\n+\t/** Convenience constructor for API users. **/\n+\tMcKibbenActuator(const std::string& name, double num_turns, double thread_length);\n \n-    /** Set the \'number of turns\' property. **/\n-    void setNumberOfTurns(double val)\n+\t/** Set the \'number of turns\' property. **/\n+\tvoid setNumberOfTurns(double val)\n     {   set_number_of_turns(val); }\n     /** Get the current value of the \'number of turns\' property. **/\n-    double getNumberOfTurns() const \n+\tdouble getNumberOfTurns() const \n     {   return get_number_of_turns(); }\n-    \n-    /** Set the \'thread length\' property. **/\n-    void setThreadLength(double val)\n+\t\n+\t/** Set the \'thread length\' property. **/\n+\tvoid setThreadLength(double val)\n     {   set_thread_length(val); }\n     /** Get the current value of the \'thread length\' property. **/\n-    double getThreadLength() const\n+\tdouble getThreadLength() const\n     {   return get_thread_length(); }\n-    \n-    /** Set the \'cord length\' property. **/\n-    void setCordLength(double val)\n+\t\n+\t/** Set the \'cord length\' property. **/\n+\tvoid setCordLength(double val)\n     {   set_cord_length(val); }\n     /** Get the current value of the \'cord length\' property. **/\n-    double getCordLength() const\n+\tdouble getCordLength() const\n     {   return get_cord_length(); }\n \n-    /** Compute actuation for current state. **/\n-    double computeActuation(const SimTK::State& s) const;\n+\t/** Compute actuation for current state. **/\n+\tdouble computeActuation(const SimTK::State& s) const;\n protected:\n     /** how to display the McKibben\n-    VisibleObject _displayer; */\n+\tVisibleObject _displayer; */\n \n private:\n-    void constructProperties();\n+\tvoid constructProperties();\n \n-    //--------------------------------------------------------------------------\n-    // Implement Force interface\n-    //--------------------------------------------------------------------------\n-    void computeForce(const SimTK::State& state, \n-                      SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                      SimTK::Vector& mobilityForces) const override;\n+\t//--------------------------------------------------------------------------\n+\t// Implement Force interface\n+\t//--------------------------------------------------------------------------\n+\tvoid computeForce(const SimTK::State& state, \n+\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t  SimTK::Vector& mobilityForces) const override;\n \n \n-    //--------------------------------------------------------------------------\n-    // Implement ModelComponent interface\n-    //--------------------------------------------------------------------------\n-    // Setup method initializes Body reference pointers to match the names.\n+\t//--------------------------------------------------------------------------\n+\t// Implement ModelComponent interface\n+\t//--------------------------------------------------------------------------\n+\t// Setup method initializes Body reference pointers to match the names.\n     void extendConnectToModel(Model& aModel) override;\n \n-    //--------------------------------------------------------------------------\n-    // Visualization interface\n-    //--------------------------------------------------------------------------\n-    /*\n-    virtual VisibleObject* getDisplayer() const;\n-    virtual void updateDisplayer(const SimTK::State& s);\n-    virtual void updateGeometry(const SimTK::State& s);*/\n+\t//--------------------------------------------------------------------------\n+\t// Visualization interface\n+\t//--------------------------------------------------------------------------\n+\n \n }; // class McKibbenActuator\n } // namespace OpenSim\ndiff --git a/OpenSim/Actuators/Test/testMuscles.cpp b/OpenSim/Actuators/Test/testMuscles.cpp\nindex 401cd2cda..2522eb9d5 100644\n--- a/OpenSim/Actuators/Test/testMuscles.cpp\n+++ b/OpenSim/Actuators/Test/testMuscles.cpp\n@@ -22,18 +22,18 @@\n  * -------------------------------------------------------------------------- */\n \n //=============================================================================\n-//  testMuscles simulates various OpenSim models using the OpenSim API and \n+//\ttestMuscles simulates various OpenSim models using the OpenSim API and \n //  compares muscle behavior for varying physical parameters (fiber-to-tendon \n //  ratio, tendon stiffness, etc...)\n //\n-//  Models tested include:\n+//\tModels tested include:\n //      1. PathActuator (Base of Muscle, is controlled tension along a GeometryPath)\n-//      2. RigidTendonMuscle (Stateless muscle with user-defined fiber f-l, f-v splines)\n+//\t\t2. RigidTendonMuscle (Stateless muscle with user-defined fiber f-l, f-v splines)\n //      3. Thelen2003Muscle_Deprecated (Simm implementation)\n-//      4. Thelen2003Muscle (Uses the Muscle interface)\n-//      5. Schutte1993Muscle(_Deprecated)\n-//      6. Delp1990Muscle(_Deprecated)\n-//      \n+//\t\t4. Thelen2003Muscle (Uses the Muscle interface)\n+//\t\t5. Schutte1993Muscle(_Deprecated)\n+//\t\t6. Delp1990Muscle(_Deprecated)\n+//\t\t\n //     Add more test cases to address specific problems with muscle models\n //\n //==============================================================================\n@@ -64,8 +64,8 @@ static const double MaxIsometricForce0  = 100.0,\n                     PennationAngle1     = SimTK::Pi/4;\n \n static const double Activation0     = 0.01, \n-                    Deactivation0   = 0.4,  \n-                    ShutteDelpActivation1 = 7.6,    \n+                    Deactivation0   = 0.4,\t\n+                    ShutteDelpActivation1 = 7.6,\t\n                     ShutteDelpActivation2 = 2.5;\n \n /*\n@@ -90,9 +90,9 @@ functioning\n void simulateMuscle(const Muscle &aMuscle, \n                     double startX, \n                     double act0, \n-                    const Function *motion, \n-                    const Function *control, \n-                    double integrationAccuracy,\n+\t\t\t\t\tconst Function *motion, \n+\t\t\t\t\tconst Function *control, \n+\t\t\t\t\tdouble integrationAccuracy,\n                     int testType,\n                     double testTolerance,\n                     bool printResults);\n@@ -108,7 +108,7 @@ void testDelp1990Muscle();\n \n int main()\n {\n-    SimTK::Array_<std::string> failures;\n+\tSimTK::Array_<std::string> failures;\n     \n     printf(\n          "The following tests have been removed:\\n" \n@@ -128,38 +128,38 @@ int main()\n \n     /*\n     try { testThelen2003Muscle_Deprecated();\n-        cout << "Thelen2003Muscle_Deprecated Test passed" << endl; }\n+\t\tcout << "Thelen2003Muscle_Deprecated Test passed" << endl; }\n     catch (const Exception& e)\n-        { e.print(cerr); failures.push_back("testThelen2003Muscle_Deprecated");}\n-        \n-    try { testSchutte1993Muscle();\n-        cout << "Schutte1993Muscle_Deprecated Test passed" << endl; }\n+\t\t{ e.print(cerr); failures.push_back("testThelen2003Muscle_Deprecated");}\n+\t\t\n+\ttry { testSchutte1993Muscle();\n+\t\tcout << "Schutte1993Muscle_Deprecated Test passed" << endl; }\n     catch (const Exception& e)\n-        { e.print(cerr); failures.push_back("testSchutte1993Muscle"); }\n+\t\t{ e.print(cerr); failures.push_back("testSchutte1993Muscle"); }\n \n-    try { testDelp1990Muscle();\n-        cout << "Delp1990Muscle_Deprecated Test passed" << endl; }\n+\ttry { testDelp1990Muscle();\n+\t\tcout << "Delp1990Muscle_Deprecated Test passed" << endl; }\n     catch (const Exception& e)\n-        { e.print(cerr); failures.push_back("testDelp1990Muscle"); }\n+\t\t{ e.print(cerr); failures.push_back("testDelp1990Muscle"); }\n */    \n     try { testRigidTendonMuscle();\n-        cout << "RigidTendonMuscle Test passed" << endl; }\n+\t\tcout << "RigidTendonMuscle Test passed" << endl; }\n     catch (const Exception& e)\n-        { e.print(cerr); failures.push_back("testRigidTendonMuscle"); }\n-    \n+\t\t{ e.print(cerr); failures.push_back("testRigidTendonMuscle"); }\n+\t\n     try { testThelen2003Muscle();\n-        cout << "Thelen2003Muscle Test passed" << endl; }\n+\t\tcout << "Thelen2003Muscle Test passed" << endl; }\n     catch (const Exception& e)\n-        { e.print(cerr); failures.push_back("testThelen2003Muscle"); }\n+\t\t{ e.print(cerr); failures.push_back("testThelen2003Muscle"); }\n     \n     try { testMillard2012EquilibriumMuscle();\n-        cout << "Millard2012EquilibriumMuscle Test passed" << endl; \n+\t\tcout << "Millard2012EquilibriumMuscle Test passed" << endl; \n     }catch (const Exception& e){ \n         e.print(cerr);\n         failures.push_back("testMillard2012EquilibriumMuscle");\n     }\n     try { testMillard2012AccelerationMuscle();\n-        cout << "Millard2012AccelerationMuscle Test passed" << endl; \n+\t\tcout << "Millard2012AccelerationMuscle Test passed" << endl; \n     }catch (const Exception& e){ \n         e.print(cerr);\n         failures.push_back("testMillard2012AccelerationMuscle");\n@@ -175,7 +175,7 @@ int main()\n     }\n \n     \n-    cout << "testMuscles Done" << endl;\n+\tcout << "testMuscles Done" << endl;\n     return 0;\n }\n \n@@ -192,62 +192,61 @@ void simulateMuscle(\n         const Muscle &aMuscModel, \n         double startX, \n         double act0, \n-        const Function *motion,  // prescribe motion of free end of muscle\n-        const Function *control, // prescribed excitation signal to the muscle\n-        double integrationAccuracy,\n+\t\tconst Function *motion,  // prescribe motion of free end of muscle\n+\t\tconst Function *control, // prescribed excitation signal to the muscle\n+\t\tdouble integrationAccuracy,\n         int testType,\n         double testTolerance,\n         bool printResults)\n {\n-    string prescribed = (motion == NULL) ? "." : " with Prescribed Motion.";\n+\tstring prescribed = (motion == NULL) ? "." : " with Prescribed Motion.";\n \n-    cout << "\\n******************************************************" << endl;\n-    cout << "Test " << aMuscModel.getConcreteClassName() \n+\tcout << "\\n******************************************************" << endl;\n+\tcout << "Test " << aMuscModel.getConcreteClassName() \n          << " Model" << prescribed << endl;\n-    cout << "******************************************************" << endl;\n-    using SimTK::Vec3;\n+\tcout << "******************************************************" << endl;\n+\tusing SimTK::Vec3;\n \n //==========================================================================\n // 0. SIMULATION SETUP: Create the block and ground\n //==========================================================================\n \n-    // Define the initial and final simulation times\n-    double initialTime = 0.0;\n-    double finalTime = 0.25;\n-    \n-    //Physical properties of the model\n-    double ballMass = 10;\n-    double ballRadius = 0.05;\n-    double anchorWidth = 0.1;\n+\t// Define the initial and final simulation times\n+\tdouble initialTime = 0.0;\n+\tdouble finalTime = 0.25;\n+\t\n+\t//Physical properties of the model\n+\tdouble ballMass = 10;\n+\tdouble ballRadius = 0.05;\n+\tdouble anchorWidth = 0.1;\n \n-    // Create an OpenSim model\n-    Model model;\n+\t// Create an OpenSim model\n+\tModel model;\n \n     double optimalFiberLength = aMuscModel.getOptimalFiberLength();\n     double pennationAngle     = aMuscModel.getPennationAngleAtOptimalFiberLength();\n     double tendonSlackLength  = aMuscModel.getTendonSlackLength();\n \n-    // Use a copy of the muscle model passed in to add path points later\n-    PathActuator *aMuscle = aMuscModel.clone();\n-    *aMuscle = aMuscModel;\n+\t// Use a copy of the muscle model passed in to add path points later\n+\tPathActuator *aMuscle = aMuscModel.clone();\n+\t*aMuscle = aMuscModel;\n \n-    // Get a reference to the model\'s ground body\n+\t// Get a reference to the model\'s ground body\n     Ground& ground = model.updGround();\n-    ground.addDisplayGeometry("box.vtp");\n-    ground.updDisplayer()\n-        ->setScaleFactors(Vec3(anchorWidth, anchorWidth, 2*anchorWidth));\n+\tground.addDisplayGeometry("box.vtp");\n+\t//ground.updDisplayer()->setScaleFactors(Vec3(anchorWidth, anchorWidth, 2*anchorWidth));\n \n-    OpenSim::Body * ball = new OpenSim::Body("ball", \n+\tOpenSim::Body * ball = new OpenSim::Body("ball", \n                         ballMass , \n                         Vec3(0),  \n                         ballMass*SimTK::Inertia::sphere(ballRadius));\n-    \n+\t\n     ball->addDisplayGeometry("sphere.vtp");\n-    ball->updDisplayer()->setScaleFactors(Vec3(2*ballRadius));\n-    // ball connected  to ground via a slider along X\n-    double xSinG = optimalFiberLength*cos(pennationAngle)+tendonSlackLength;\n+\t//ball->updDisplayer()->setScaleFactors(Vec3(2*ballRadius));\n+\t// ball connected  to ground via a slider along X\n+\tdouble xSinG = optimalFiberLength*cos(pennationAngle)+tendonSlackLength;\n \n-    SliderJoint* slider = new SliderJoint( "slider", \n+\tSliderJoint* slider = new SliderJoint( "slider", \n                         ground, \n                         Vec3(anchorWidth/2+xSinG, 0, 0), \n                         Vec3(0), \n@@ -255,104 +254,104 @@ void simulateMuscle(\n                         Vec3(0), \n                         Vec3(0));\n \n-    CoordinateSet& jointCoordinateSet = slider->upd_CoordinateSet();\n-        jointCoordinateSet[0].setName("tx");\n-        jointCoordinateSet[0].setDefaultValue(1.0);\n-        jointCoordinateSet[0].setRangeMin(0); \n+\tCoordinateSet& jointCoordinateSet = slider->upd_CoordinateSet();\n+\t    jointCoordinateSet[0].setName("tx");\n+\t    jointCoordinateSet[0].setDefaultValue(1.0);\n+\t    jointCoordinateSet[0].setRangeMin(0); \n         jointCoordinateSet[0].setRangeMax(1.0);\n-    \n+\t\n     if(motion != NULL){\n-        jointCoordinateSet[0].setPrescribedFunction(*motion);\n-        jointCoordinateSet[0].setDefaultIsPrescribed(true);\n-    }\n-    // add ball to model\n-    model.addBody(ball);\n-    model.addJoint(slider);\n+\t\tjointCoordinateSet[0].setPrescribedFunction(*motion);\n+\t\tjointCoordinateSet[0].setDefaultIsPrescribed(true);\n+\t}\n+\t// add ball to model\n+\tmodel.addBody(ball);\n+\tmodel.addJoint(slider);\n \n //==========================================================================\n // 1. SIMULATION SETUP: Add the muscle\n //==========================================================================\n \n-    //Attach the muscle\n-    const string &actuatorType = aMuscle->getConcreteClassName();\n-    aMuscle->setName("muscle");\n-    aMuscle->addNewPathPoint("muscle-box", ground, Vec3(anchorWidth/2,0,0));\n-    aMuscle->addNewPathPoint("muscle-ball", *ball, Vec3(-ballRadius,0,0));\n-    \n-    ActivationFiberLengthMuscle_Deprecated *aflMuscle \n+\t//Attach the muscle\n+\tconst string &actuatorType = aMuscle->getConcreteClassName();\n+\taMuscle->setName("muscle");\n+\taMuscle->addNewPathPoint("muscle-box", ground, Vec3(anchorWidth/2,0,0));\n+\taMuscle->addNewPathPoint("muscle-ball", *ball, Vec3(-ballRadius,0,0));\n+\t\n+\tActivationFiberLengthMuscle_Deprecated *aflMuscle \n         = dynamic_cast<ActivationFiberLengthMuscle_Deprecated *>(aMuscle);\n-    if(aflMuscle){\n-        // Define the default states for the muscle that has \n+\tif(aflMuscle){\n+\t\t// Define the default states for the muscle that has \n         //activation and fiber-length states\n-        aflMuscle->setDefaultActivation(act0);\n-        aflMuscle->setDefaultFiberLength(aflMuscle->getOptimalFiberLength());\n-    }else{\n-        ActivationFiberLengthMuscle *aflMuscle2 \n+\t\taflMuscle->setDefaultActivation(act0);\n+\t\taflMuscle->setDefaultFiberLength(aflMuscle->getOptimalFiberLength());\n+\t}else{\n+\t\tActivationFiberLengthMuscle *aflMuscle2 \n             = dynamic_cast<ActivationFiberLengthMuscle *>(aMuscle);\n-        if(aflMuscle2){\n-            // Define the default states for the muscle \n+\t\tif(aflMuscle2){\n+\t\t\t// Define the default states for the muscle \n             //that has activation and fiber-length states\n-            aflMuscle2->setDefaultActivation(act0);\n-            aflMuscle2->setDefaultFiberLength(aflMuscle2\n+\t\t\taflMuscle2->setDefaultActivation(act0);\n+\t\t\taflMuscle2->setDefaultFiberLength(aflMuscle2\n                 ->getOptimalFiberLength());\n-        }\n-    }\n+\t\t}\n+\t}\n \n-    model.addForce(aMuscle);\n+\tmodel.addForce(aMuscle);\n \n-    // Create a prescribed controller that simply \n+\t// Create a prescribed controller that simply \n     //applies controls as function of time\n-    PrescribedController * muscleController = new PrescribedController();\n-    if(control != NULL){\n-        muscleController->setActuators(model.updActuators());\n-        // Set the indiviudal muscle control functions \n+\tPrescribedController * muscleController = new PrescribedController();\n+\tif(control != NULL){\n+\t\tmuscleController->setActuators(model.updActuators());\n+\t\t// Set the indiviudal muscle control functions \n         //for the prescribed muscle controller\n-        muscleController->prescribeControlForActuator("muscle",control->clone());\n+\t\tmuscleController->prescribeControlForActuator("muscle",control->clone());\n \n-        // Add the control set controller to the model\n-        model.addController(muscleController);\n-    }\n+\t\t// Add the control set controller to the model\n+\t\tmodel.addController(muscleController);\n+\t}\n \n     // Set names for muscles / joints.\n     Array<string> muscNames;\n-    muscNames.append(aMuscle->getName());\n+\tmuscNames.append(aMuscle->getName());\n     Array<string> jointNames;\n-    jointNames.append("slider");\n+\tjointNames.append("slider");\n \n //==========================================================================\n // 2. SIMULATION SETUP: Instrument the test with probes\n //==========================================================================\n \n-    // Add an ActuatorPowerProbe to measure the work done by the muscle actuator \n+\t// Add an ActuatorPowerProbe to measure the work done by the muscle actuator \n     ActuatorPowerProbe * muscWorkProbe = new ActuatorPowerProbe(muscNames, true, 1);\n-    muscWorkProbe->setOperation("integrate");\n-    model.addProbe(muscWorkProbe);\n+\tmuscWorkProbe->setOperation("integrate");\n+\tmodel.addProbe(muscWorkProbe);\n \n-    // Add a JointInternalPowerProbe to measure the work done by the joint\n-    // will be 0 unless joint has prescribed motion\n+\t// Add a JointInternalPowerProbe to measure the work done by the joint\n+\t// will be 0 unless joint has prescribed motion\n     JointInternalPowerProbe * jointWorkProbe = new JointInternalPowerProbe(jointNames, true, 1);\n-    jointWorkProbe->setOperation("integrate");\n-    model.addProbe(jointWorkProbe);\n+\tjointWorkProbe->setOperation("integrate");\n+\tmodel.addProbe(jointWorkProbe);\n \n-    /* Since all components are allocated on the stack don\'t have model \n+\t/* Since all components are allocated on the stack don\'t have model \n        own them (and try to free)*/\n-//  model.disownAllComponents();\n-    model.setName(actuatorType+"ModelTest");\n-    model.print(actuatorType+"ModelTest.osim");\n+//\tmodel.disownAllComponents();\n+\tmodel.setName(actuatorType+"ModelTest");\n+\tmodel.print(actuatorType+"ModelTest.osim");\n \n-    /* Setup a Muscle Analysis to report all internal values of the \n+\t/* Setup a Muscle Analysis to report all internal values of the \n        muscle during the simulation. If you uncomment, remember to \n        uncomment the corresponding calls to write the results to \n        file after the simualtion.*/\n-    MuscleAnalysis * muscleAnalysis = new MuscleAnalysis();\n+\tMuscleAnalysis * muscleAnalysis = new MuscleAnalysis();\n     Array<string> tmp; \n-    tmp.append("muscle");\n+\ttmp.append("muscle");\n     muscleAnalysis->setMuscles(tmp);\n-    model.addAnalysis(muscleAnalysis);\n+\tmodel.addAnalysis(muscleAnalysis);\n    \n     /*\n         Muscle *musclePtr = dynamic_cast<Muscle *>(aMuscle);\n-        MuscleActiveFiberPowerProbe fiberPowerProbe(&musclePtr); \n+\t    MuscleActiveFiberPowerProbe fiberPowerProbe(&musclePtr); \n         fiberPowerProbe.setName("ActiveFiberPower");\n         fiberPowerProbe.setOperation("integrate");\n         fiberPowerProbe.setOperationParameter(0);\n@@ -362,72 +361,72 @@ void simulateMuscle(\n         }\n     */\n \n-    // Define visualizer for debugging\n-    //model.setUseVisualizer(true);\n+\t// Define visualizer for debugging\n+\t//model.setUseVisualizer(true);\n \n //==========================================================================\n // 3. SIMULATION Initialization\n //==========================================================================\n \n-    // Initialize the system and get the default state    \n-    SimTK::State& si = model.initSystem();\n-    model.getMultibodySystem().realize(si,SimTK::Stage::Dynamics);\n+\t// Initialize the system and get the default state    \n+\tSimTK::State& si = model.initSystem();\n+\tmodel.getMultibodySystem().realize(si,SimTK::Stage::Dynamics);\n     model.equilibrateMuscles(si);\n \n-    CoordinateSet& modelCoordinateSet = model.updCoordinateSet();\n+\tCoordinateSet& modelCoordinateSet = model.updCoordinateSet();\n \n-    // Define non-zero (defaults are 0) states for the free joint\n+\t// Define non-zero (defaults are 0) states for the free joint\n     // set x-translation value\n-    modelCoordinateSet[0].setValue(si, startX, true); \n+\tmodelCoordinateSet[0].setValue(si, startX, true); \n \n     //Copy the initial state\n     SimTK::State initialState(si);\n \n-    // Check muscle is setup correctly \n-    const PathActuator &muscle \n+\t// Check muscle is setup correctly \n+\tconst PathActuator &muscle \n         = dynamic_cast<const PathActuator&>(model.updActuators().get("muscle"));\n-    double length = muscle.getLength(si);\n-    double trueLength = startX + xSinG - anchorWidth/2;\n-    \n+\tdouble length = muscle.getLength(si);\n+\tdouble trueLength = startX + xSinG - anchorWidth/2;\n+\t\n     ASSERT_EQUAL(length/trueLength, 1.0, testTolerance, __FILE__, __LINE__, \n-        "testMuscles: path failed to initialize to correct length." );\n+\t\t"testMuscles: path failed to initialize to correct length." );\n \n-    model.getMultibodySystem().realize(si, SimTK::Stage::Acceleration);\n+\tmodel.getMultibodySystem().realize(si, SimTK::Stage::Acceleration);\n \n-    double Emuscle0 = muscWorkProbe->getProbeOutputs(si)(0);\n-    //cout << "Muscle initial energy = " << Emuscle0 << endl;\n-    double Esys0 = model.getMultibodySystem().calcEnergy(si);\n-    Esys0 += (Emuscle0 + jointWorkProbe->getProbeOutputs(si)(0));\n-    double PEsys0 = model.getMultibodySystem().calcPotentialEnergy(si);\n-    //cout << "Total initial system energy = " << Esys0 << endl; \n+\tdouble Emuscle0 = muscWorkProbe->getProbeOutputs(si)(0);\n+\t//cout << "Muscle initial energy = " << Emuscle0 << endl;\n+\tdouble Esys0 = model.getMultibodySystem().calcEnergy(si);\n+\tEsys0 += (Emuscle0 + jointWorkProbe->getProbeOutputs(si)(0));\n+\tdouble PEsys0 = model.getMultibodySystem().calcPotentialEnergy(si);\n+\t//cout << "Total initial system energy = " << Esys0 << endl; \n \n //==========================================================================\n // 4. SIMULATION Integration\n //==========================================================================\n \n-    // Create the integrator\n-    SimTK::RungeKuttaMersonIntegrator integrator(model.getMultibodySystem());\n-    integrator.setAccuracy(integrationAccuracy);\n+\t// Create the integrator\n+\tSimTK::RungeKuttaMersonIntegrator integrator(model.getMultibodySystem());\n+\tintegrator.setAccuracy(integrationAccuracy);\n \n-    // Create the manager\n-    Manager manager(model, integrator);\n+\t// Create the manager\n+\tManager manager(model, integrator);\n \n-    // Integrate from initial time to final time\n-    manager.setInitialTime(initialTime);\n-    manager.setFinalTime(finalTime);\n-    cout<<"\\nIntegrating from " << initialTime<< " to " << finalTime << endl;\n+\t// Integrate from initial time to final time\n+\tmanager.setInitialTime(initialTime);\n+\tmanager.setFinalTime(finalTime);\n+\tcout<<"\\nIntegrating from " << initialTime<< " to " << finalTime << endl;\n \n-    // Start timing the simulation\n-    const clock_t start = clock();\n-    // simulate\n-    manager.integrate(si);\n+\t// Start timing the simulation\n+\tconst clock_t start = clock();\n+\t// simulate\n+\tmanager.integrate(si);\n \n-    // how long did it take?\n-    double comp_time = (double)(clock()-start)/CLOCKS_PER_SEC;\n+\t// how long did it take?\n+\tdouble comp_time = (double)(clock()-start)/CLOCKS_PER_SEC;\n \n-    // Save the simulation results\n-    Storage states(manager.getStateStorage());\n-    states.print(actuatorType+"_states.sto");\n+\t// Save the simulation results\n+\tStorage states(manager.getStateStorage());\n+\tstates.print(actuatorType+"_states.sto");\n \n \n //==========================================================================\n@@ -451,12 +450,12 @@ void simulateMuscle(\n \n     //An analysis only writes to a dir that exists, so create here.\n     if(printResults == true){\n-        IO::makeDir("testMuscleResults");\n-        muscleAnalysis->printResults(actuatorType, "testMuscleResults");\n+\t    IO::makeDir("testMuscleResults");\n+\t    muscleAnalysis->printResults(actuatorType, "testMuscleResults");\n     }\n \n-    double muscleWork = muscWorkProbe->getProbeOutputs(si)(0);\n-    cout << "Muscle work = " << muscleWork << endl;\n+\tdouble muscleWork = muscWorkProbe->getProbeOutputs(si)(0);\n+\tcout << "Muscle work = " << muscleWork << endl;\n \n //==========================================================================\n // 6. SIMULATION Tests\n@@ -490,30 +489,30 @@ void simulateMuscle(\n     an explicit KE+PE-W test.\n ============================================================================\n */    \n-    \n+\t\n \n     if(false){\n         model.getMultibodySystem().realize(si, SimTK::Stage::Acceleration);\n-        double Esys = model.getMultibodySystem().calcEnergy(si);\n-        double KEsys =  model.getMultibodySystem().calcKineticEnergy(si);\n-        double xSpeed = modelCoordinateSet[0].getSpeedValue(si);\n-        double KEsysCheck =  0.5*ballMass*xSpeed*xSpeed;\n-        double PEsys =  model.getMultibodySystem().calcPotentialEnergy(si);\n+\t    double Esys = model.getMultibodySystem().calcEnergy(si);\n+\t    double KEsys =  model.getMultibodySystem().calcKineticEnergy(si);\n+\t    double xSpeed = modelCoordinateSet[0].getSpeedValue(si);\n+\t    double KEsysCheck =  0.5*ballMass*xSpeed*xSpeed;\n+\t    double PEsys =  model.getMultibodySystem().calcPotentialEnergy(si);\n         double jointWork = jointWorkProbe->computeProbeInputs(si)(0);\n-        double ESysMinusWork = Esys \n+\t    double ESysMinusWork = Esys \n                                 - muscWorkProbe->computeProbeInputs(si)(0)\n                                 - jointWork; \n \n \n         double muscleWork = 0;//fiberWorkMeter.get\n         muscWorkProbe->computeProbeInputs(si);\n-        cout << "Muscle work = " << muscleWork << endl;  \n+\t    cout << "Muscle work = " << muscleWork << endl;  \n         cout << "Esys - Work = " << ESysMinusWork \n              << " :: Esys0 = " << Esys0 << endl; \n-        ASSERT_EQUAL(ESysMinusWork, Esys0, testTolerance, __FILE__, __LINE__, \n-            "testMuscles: System energy-work -not conserved.");\n-                \n-        //Minimum requirement to pass is simulation of single \n+\t    ASSERT_EQUAL(ESysMinusWork, Esys0, testTolerance, __FILE__, __LINE__, \n+\t    \t"testMuscles: System energy-work -not conserved.");\n+\t    \t    \n+\t    //Minimum requirement to pass is simulation of single \n         //muscle on slider is real-time\n \n     }\n@@ -526,7 +525,7 @@ void simulateMuscle(\n */      \n     if(testType == 2){\n         Storage *fiberActivePwrSto  \n-            = muscleAnalysis->getFiberActivePowerStorage(); \n+\t\t\t= muscleAnalysis->getFiberActivePowerStorage(); \n         Storage *fiberPassivePwrSto \n             = muscleAnalysis->getFiberPassivePowerStorage();\n         Storage *tendonPwrSto       \n@@ -568,7 +567,7 @@ void simulateMuscle(\n                                 testTolerance,  \n                                 __FILE__, \n                                 __LINE__,\n-                            "testMuscles: d/dt(system energy-work) non-zero.");\n+\t    \t                "testMuscles: d/dt(system energy-work) non-zero.");\n             }else{\n                 flag_notTested = true;\n             }\n@@ -606,52 +605,52 @@ void simulateMuscle(\n \n /*void testPathActuator()\n {\n-    double x0 = 0;\n-    double act0 = 0.2;\n-    double loadX = 50;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n+\tdouble loadX = 50;\n \n-    PathActuator muscle;\n-    muscle.setOptimalForce(maxIsometricForce0);\n+\tPathActuator muscle;\n+\tmuscle.setOptimalForce(maxIsometricForce0);\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(0.1, SimTK::Pi, 0);\n+\tSine motion(0.1, SimTK::Pi, 0);\n \n-    // concentric\n-    //simulateMuscle(muscle, x0, act0, NULL, &control, accuracy);\n-    // eccentric \n-    simulateMuscle(muscle, x0, act0, &motion, &control, accuracy,false);\n+\t// concentric\n+\t//simulateMuscle(muscle, x0, act0, NULL, &control, accuracy);\n+\t// eccentric \n+\tsimulateMuscle(muscle, x0, act0, &motion, &control, accuracy,false);\n }*/\n \n \n void testRigidTendonMuscle()\n {\n-    RigidTendonMuscle   muscle( "muscle",\n+\tRigidTendonMuscle   muscle( "muscle",\n                                 MaxIsometricForce0,\n                                 OptimalFiberLength0,\n                                 TendonSlackLength0,\n                                 PennationAngle0);\n \n-    double x0 = 0;\n-    double act0 = 0.5;\n-    Constant control(act0);\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.5;\n+\tConstant control(act0);\n \n-    Sine sineWave(0.1, SimTK::Pi, 0);\n+\tSine sineWave(0.1, SimTK::Pi, 0);\n \n     /*\n     void simulateMuscle(const Muscle &aMuscle, \n                     double startX, \n                     double act0, \n-                    const Function *motion, \n-                    const Function *control, \n-                    double integrationAccuracy,\n+\t\t\t\t\tconst Function *motion, \n+\t\t\t\t\tconst Function *control, \n+\t\t\t\t\tdouble integrationAccuracy,\n                     int testType,\n                     double testTolerance,\n                     bool printResults);\n     */\n \n-    // concentric\n-    simulateMuscle(muscle, \n+\t// concentric\n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         NULL, \n@@ -660,8 +659,8 @@ void testRigidTendonMuscle()\n         SimulationTest,\n         SimulationTestTolerance,\n         false);\n-    // eccentric \n-    simulateMuscle(muscle, \n+\t// eccentric \n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         &sineWave, \n@@ -687,23 +686,23 @@ void testRigidTendonMuscle()\n \n void testThelen2003Muscle_Deprecated()\n {\n-    Thelen2003Muscle_Deprecated muscle("muscle",\n+\tThelen2003Muscle_Deprecated muscle("muscle",\n                                         MaxIsometricForce0,\n                                         OptimalFiberLength0,\n                                         TendonSlackLength0,\n                                         PennationAngle0);\n \n-    muscle.setActivationTimeConstant(Activation0);\n-    muscle.setDeactivationTimeConstant(Deactivation0);\n+\tmuscle.setActivationTimeConstant(Activation0);\n+\tmuscle.setDeactivationTimeConstant(Deactivation0);\n \n-    double x0 = 0;\n-    double act0 = 0.2;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(0.1, SimTK::Pi, 0);\n+\tSine motion(0.1, SimTK::Pi, 0);\n \n-    simulateMuscle( muscle, \n+\tsimulateMuscle( muscle, \n                     x0, \n                     act0, \n                     NULL, \n@@ -712,13 +711,13 @@ void testThelen2003Muscle_Deprecated()\n                     SimulationTest,\n                     SimulationTestTolerance,\n                     false);\n-    \n+\t\n }\n \n void testThelen2003Muscle()\n {\n \n-    Thelen2003Muscle muscle("muscle",\n+\tThelen2003Muscle muscle("muscle",\n                             MaxIsometricForce0,\n                             OptimalFiberLength0,\n                             TendonSlackLength0,\n@@ -730,17 +729,17 @@ void testThelen2003Muscle()\n                             TendonSlackLength0,\n                             PennationAngle1);\n \n-    muscle.setActivationTimeConstant(Activation0);\n-    muscle.setDeactivationTimeConstant(Deactivation0);\n+\tmuscle.setActivationTimeConstant(Activation0);\n+\tmuscle.setDeactivationTimeConstant(Deactivation0);\n \n-    double x0 = 0;\n-    double act0 = 0.2;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(OptimalFiberLength0, SimTK::Pi*2, 0);\n+\tSine motion(OptimalFiberLength0, SimTK::Pi*2, 0);\n \n-    simulateMuscle(muscle, \n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         &motion, \n@@ -842,7 +841,7 @@ void testThelen2003Muscle()\n \n void testMillard2012EquilibriumMuscle()\n {\n-    Millard2012EquilibriumMuscle muscle("muscle",\n+\tMillard2012EquilibriumMuscle muscle("muscle",\n                             MaxIsometricForce0,\n                             OptimalFiberLength0,\n                             TendonSlackLength0,\n@@ -851,14 +850,14 @@ void testMillard2012EquilibriumMuscle()\n     muscle.setActivationTimeConstant(Activation0);\n     muscle.setDeactivationTimeConstant(Deactivation0);\n \n-    double x0 = 0;\n-    double act0 = 0.2;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(0.1, SimTK::Pi, 0);\n+\tSine motion(0.1, SimTK::Pi, 0);\n \n-    simulateMuscle(muscle, \n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         &motion, \n@@ -881,7 +880,7 @@ void testMillard2012EquilibriumMuscle()\n \n void testMillard2012AccelerationMuscle()\n {\n-    Millard2012AccelerationMuscle muscle("muscle",\n+\tMillard2012AccelerationMuscle muscle("muscle",\n                             MaxIsometricForce0,\n                             OptimalFiberLength0,\n                             TendonSlackLength0,\n@@ -895,14 +894,14 @@ void testMillard2012AccelerationMuscle()\n     actMdl.set_deactivation_time_constant(Deactivation0);\n     muscle.setActivationModel(actMdl);\n \n-    double x0 = 0;\n-    double act0 = 0.2;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(0.1, SimTK::Pi, 0);\n+\tSine motion(0.1, SimTK::Pi, 0);\n \n-    simulateMuscle(muscle, \n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         &motion, \n@@ -925,23 +924,23 @@ void testMillard2012AccelerationMuscle()\n \n void testSchutte1993Muscle()\n {\n-    Schutte1993Muscle_Deprecated muscle("muscle",\n+\tSchutte1993Muscle_Deprecated muscle("muscle",\n                                         MaxIsometricForce0,\n                                         OptimalFiberLength0,\n                                         TendonSlackLength0,\n                                         PennationAngle0);\n \n-    muscle.setActivation1(ShutteDelpActivation1);\n-    muscle.setActivation2(ShutteDelpActivation2);\n+\tmuscle.setActivation1(ShutteDelpActivation1);\n+\tmuscle.setActivation2(ShutteDelpActivation2);\n \n-    double x0 = 0;\n-    double act0 = 0.2;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(0.1, SimTK::Pi, 0);\n+\tSine motion(0.1, SimTK::Pi, 0);\n \n-    simulateMuscle(muscle, \n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         &motion, \n@@ -956,24 +955,24 @@ void testSchutte1993Muscle()\n \n void testDelp1990Muscle()\n {\n-    Delp1990Muscle_Deprecated muscle("muscle",\n+\tDelp1990Muscle_Deprecated muscle("muscle",\n                                     MaxIsometricForce0,\n                                     OptimalFiberLength0,\n                                     TendonSlackLength0,\n                                     PennationAngle0);\n \n-    muscle.setActivation1(ShutteDelpActivation1);\n-    muscle.setActivation2(ShutteDelpActivation2);\n-    muscle.setMass(0.1);\n+\tmuscle.setActivation1(ShutteDelpActivation1);\n+\tmuscle.setActivation2(ShutteDelpActivation2);\n+\tmuscle.setMass(0.1);\n \n-    double x0 = 0;\n-    double act0 = 0.2;\n+\tdouble x0 = 0;\n+\tdouble act0 = 0.2;\n \n-    Constant control(0.5);\n+\tConstant control(0.5);\n \n-    Sine motion(0.1, SimTK::Pi, 0);\n+\tSine motion(0.1, SimTK::Pi, 0);\n \n-    simulateMuscle(muscle, \n+\tsimulateMuscle(muscle, \n         x0, \n         act0, \n         &motion, \ndiff --git a/OpenSim/Common/DisplayGeometry.cpp b/OpenSim/Common/DisplayGeometry.cpp\ndeleted file mode 100644\nindex 24b924477..000000000\n--- a/OpenSim/Common/DisplayGeometry.cpp\n+++ /dev/null\n@@ -1,186 +0,0 @@\n-/* -------------------------------------------------------------------------- *\n- *                       OpenSim:  DisplayGeometry.cpp                        *\n- * -------------------------------------------------------------------------- *\n- * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *\n- * See http://opensim.stanford.edu and the NOTICE file for more information.  *\n- * OpenSim is developed at Stanford University and supported by the US        *\n- * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *\n- * through the Warrior Web program.                                           *\n- *                                                                            *\n- * Copyright (c) 2005-2012 Stanford University and the Authors                *\n- * Author(s): Ayman Habib                                                     *\n- *                                                                            *\n- * Licensed under the Apache License, Version 2.0 (the "License"); you may    *\n- * not use this file except in compliance with the License. You may obtain a  *\n- * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *\n- *                                                                            *\n- * Unless required by applicable law or agreed to in writing, software        *\n- * distributed under the License is distributed on an "AS IS" BASIS,          *\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *\n- * See the License for the specific language governing permissions and        *\n- * limitations under the License.                                             *\n- * -------------------------------------------------------------------------- */\n-\n-/*  \n- * Author:  Ayman Habib\n- */\n-#include "DisplayGeometry.h"\n-\n-using namespace std;\n-using namespace OpenSim;\n-\n-//=============================================================================\n-//=============================================================================\n-/**\n- * A class for representing one DisplayGeometry of an object, e.g. one bone\n- *\n- * @author Ayman Habib\n- * @version 1.0\n- */\n-//=============================================================================\n-// CONSTRUCTOR(S) AND DESTRUCTOR\n-//=============================================================================\n-//_____________________________________________________________________________\n-/**\n- * Default constructor.\n- */\n-DisplayGeometry::DisplayGeometry() :\n-_geometryFile(_propGeometryFile.getValueStr()),\n-_color(_propColor.getValueDblVec()),\n-_textureFile(_propTextureFile.getValueStr()),\n-_propTransform(PropertyTransform("", SimTK::Transform())),\n-_transform(_propTransform.getValueTransform()),\n-_scaleFactors(_propScaleFactors.getValueDblVec()),\n-_displayPreference((DisplayPreference&)_propDisplayPreference.getValueInt()),\n-_opacity(_propOpacity.getValueDbl())\n-{\n-    setNull();\n-}\n-\n-DisplayGeometry::DisplayGeometry(const std::string &aFileName) :\n-_geometryFile(_propGeometryFile.getValueStr()),\n-_color(_propColor.getValueDblVec()),\n-_textureFile(_propTextureFile.getValueStr()),\n-_propTransform(PropertyTransform("", SimTK::Transform())),\n-_transform(_propTransform.getValueTransform()),\n-_scaleFactors(_propScaleFactors.getValueDblVec()),\n-_displayPreference((DisplayPreference&)_propDisplayPreference.getValueInt()),\n-_opacity(_propOpacity.getValueDbl())\n-{\n-    setNull();\n-\n-    _geometryFile=aFileName;\n-}\n-\n-//_____________________________________________________________________________\n-/**\n- * Copy constructor.\n- *\n- * @param aGeometryPiece DisplayGeometry to be copied.\n- */\n-DisplayGeometry::DisplayGeometry(const DisplayGeometry &aGeometryPiece) :\n-Object(aGeometryPiece),\n-_geometryFile(_propGeometryFile.getValueStr()),\n-_color(_propColor.getValueDblVec()),\n-_textureFile(_propTextureFile.getValueStr()),\n-_propTransform(PropertyTransform("", SimTK::Transform())),\n-_transform(_propTransform.getValueTransform()),\n-_scaleFactors(_propScaleFactors.getValueDblVec()),\n-_displayPreference((DisplayPreference&)_propDisplayPreference.getValueInt()),\n-_opacity(_propOpacity.getValueDbl())\n-{\n-    setNull();\n-    //setupProperties();\n-    copyData(aGeometryPiece);\n-\n-}\n-//=============================================================================\n-// CONSTRUCTION METHODS\n-//=============================================================================\n-//_____________________________________________________________________________\n-/**\n- * Set all member variables to their null or default values.\n- */\n-void DisplayGeometry::\n-setNull()\n-{\n-    setName("");\n-\n-    setupProperties();\n-\n-    // Assign default values\n-    _color = 1.0;\n-    _textureFile="";\n-    _transform=SimTK::Transform();\n-    _scaleFactors = 1.0;\n-    _displayPreference = GouraudShaded;\n-    _opacity = 1.0;\n-}\n-\n-//_____________________________________________________________________________\n-/**\n- * Connect properties to local pointers.\n- */\n-void DisplayGeometry::setupProperties()\n-{\n-\n-    _propGeometryFile.setName("geometry_file");\n-    _propGeometryFile.setComment("Name of geometry file .vtp, .stl, .obj");\n-    _propertySet.append(&_propGeometryFile);\n-\n-    _propColor.setName("color");\n-    _propColor.setComment("Color used to display the geometry when visible");\n-    _propertySet.append(&_propColor);\n-\n-    _propTextureFile.setName("texture_file");\n-    _propTextureFile.setComment("Name of texture file .jpg, .bmp");\n-    _propertySet.append(&_propTextureFile);\n-\n-    _propTransform.setName("transform");\n-    _propTransform.setComment("in body transform specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz");\n-    _propertySet.append(&_propTransform);\n-\n-    _propScaleFactors.setName("scale_factors");\n-    _propScaleFactors.setComment("Three scale factors for display purposes: scaleX scaleY scaleZ");\n-    _propertySet.append(&_propScaleFactors);\n-\n-    _propDisplayPreference.setName("display_preference");\n-    _propDisplayPreference.setComment("Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded");\n-    _propertySet.append(&_propDisplayPreference);\n-\n-    _propOpacity.setName("opacity");\n-    _propOpacity.setComment("Display opacity between 0.0 and 1.0");\n-    _propertySet.append(&_propOpacity);\n-\n-}\n-\n-void DisplayGeometry::copyData(const DisplayGeometry &aGeometryPiece)\n-{\n-    _geometryFile=aGeometryPiece._geometryFile;\n-    _color=aGeometryPiece._color;\n-    _textureFile=aGeometryPiece._textureFile;\n-    _transform=aGeometryPiece._transform;\n-    _scaleFactors=aGeometryPiece._scaleFactors;\n-    _displayPreference=aGeometryPiece._displayPreference;\n-    _opacity = aGeometryPiece._opacity;\n-}\n-\n-void DisplayGeometry::setRotationsAndTRanslations(double aArray[])\n-{\n-    _propTransform.setValue(6, aArray);\n-}\n-//=============================================================================\n-// OPERATORS\n-//=============================================================================\n-//_____________________________________________________________________________\n-/**\n- * Assignment operator.\n- *\n- * @return Reference to this object.\n- */\n-DisplayGeometry& DisplayGeometry::operator=(const DisplayGeometry &aDisplayGeometry)\n-{\n-    Object::operator=(aDisplayGeometry);\n-    copyData(aDisplayGeometry);\n-    return(*this);\n-}\ndiff --git a/OpenSim/Common/DisplayGeometry.h b/OpenSim/Common/DisplayGeometry.h\ndeleted file mode 100644\nindex dfd6bedd0..000000000\n--- a/OpenSim/Common/DisplayGeometry.h\n+++ /dev/null\n@@ -1,177 +0,0 @@\n-#ifndef _DisplayGeometry_h_\n-#define _DisplayGeometry_h_\n-/* -------------------------------------------------------------------------- *\n- *                        OpenSim:  DisplayGeometry.h                         *\n- * -------------------------------------------------------------------------- *\n- * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *\n- * See http://opensim.stanford.edu and the NOTICE file for more information.  *\n- * OpenSim is developed at Stanford University and supported by the US        *\n- * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *\n- * through the Warrior Web program.                                           *\n- *                                                                            *\n- * Copyright (c) 2005-2012 Stanford University and the Authors                *\n- * Author(s): Ayman Habib                                                     *\n- *                                                                            *\n- * Licensed under the Apache License, Version 2.0 (the "License"); you may    *\n- * not use this file except in compliance with the License. You may obtain a  *\n- * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *\n- *                                                                            *\n- * Unless required by applicable law or agreed to in writing, software        *\n- * distributed under the License is distributed on an "AS IS" BASIS,          *\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *\n- * See the License for the specific language governing permissions and        *\n- * limitations under the License.                                             *\n- * -------------------------------------------------------------------------- */\n-\n-/*  \n- * Author:  \n- */\n-\n-#include "osimCommonDLL.h"\n-#include "PropertyDbl.h"\n-#include "PropertyStr.h"\n-#include "PropertyDblArray.h"\n-#include "PropertyDblVec.h"\n-#include "PropertyTransform.h"\n-#include "PropertyInt.h"\n-#include "Object.h"\n-#include "Set.h"\n-\n-namespace OpenSim { \n-\n-//=============================================================================\n-//=============================================================================\n-/**\n- * A class for representing the DisplayGeometry properties of an object.\n- *\n- * @author Ayman Habib\n- * @version 1.0\n- */\n-class OSIMCOMMON_API DisplayGeometry: public Object {\n-OpenSim_DECLARE_CONCRETE_OBJECT(DisplayGeometry, Object);\n-\n-//=============================================================================\n-// DATA\n-//=============================================================================\n-public:\n-    enum  DisplayPreference {\n-            None=0,\n-            WireFrame=1,\n-            SolidFill=2,\n-            FlatShaded=3,\n-            GouraudShaded=4\n-    };\n-protected:\n-    /** Name of geomtry file .vtp, .stl, .obj are supported */\n-    PropertyStr     _propGeometryFile;\n-    std::string&    _geometryFile;\n-\n-    /** A list of 3 colors */\n-    PropertyDblVec3 _propColor;\n-    SimTK::Vec3&    _color;\n-\n-    /** Opacity */\n-    PropertyDbl _propOpacity;\n-    double& _opacity;\n-\n-    /** Texture file */\n-    PropertyStr     _propTextureFile;\n-    std::string&    _textureFile;\n-\n-    /** Transform relative to owner\'s frame */\n-    PropertyTransform   _propTransform;\n-    SimTK::Transform&   _transform;\n-\n-    /** A list of 3 scale factors in X, Y, Z directions */\n-    PropertyDblVec3 _propScaleFactors;\n-    SimTK::Vec3&    _scaleFactors;\n-\n-    /** DisplayPreference 0 up to 4 */\n-    PropertyInt _propDisplayPreference;\n-    DisplayPreference& _displayPreference;\n-\n-//=============================================================================\n-// METHODS\n-//=============================================================================\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n-public:\n-    DisplayGeometry();\n-    DisplayGeometry(const std::string &aFileName);\n-    DisplayGeometry(const DisplayGeometry &aDisplayGeometry);\n-    virtual ~DisplayGeometry() {}\n-\n-private:\n-    void setNull();\n-    void copyData(const DisplayGeometry &aDisplayGeometry);\n-\n-protected:\n-    // Serialization support\n-    virtual void setupProperties();\n-\n-    //--------------------------------------------------------------------------\n-    // OPERATORS\n-    //--------------------------------------------------------------------------\n-public:\n-#ifndef SWIG\n-    DisplayGeometry& operator=(const DisplayGeometry &aObject);\n-    bool operator==(const DisplayGeometry &aObject) const { return (_geometryFile== aObject._geometryFile); };\n-#endif\n-    //--------------------------------------------------------------------------\n-    // GET AND SET\n-    //--------------------------------------------------------------------------\n-    const std::string&  getGeometryFile() const { return _geometryFile; };\n-    void setGeometryFile(const std::string& aGeometryFile) { _geometryFile=aGeometryFile; };\n-\n-    SimTK::Vec3&    getColor() const { return _color; };\n-    void getColor(double aColor[3]) \n-    {\n-        for(int i=0; i< 3; i++) aColor[i] = _color[i];\n-    }\n-    void setColor(const SimTK::Vec3&    aColor) { _color=aColor; };\n-    void setColor(double aColor[3])\n-    {\n-        for(int i=0; i< 3; i++) _color[i] = aColor[i];\n-    }\n-\n-    const std::string&  getTextureFile() const { return _textureFile; };\n-    void setTextureFile(const std::string&  aTextureFile) { _textureFile=aTextureFile; };\n-\n-    SimTK::Transform&   getTransform() const { return _transform; };\n-    void setTransform(const SimTK::Transform&   aTransform) { _transform=aTransform; };\n-    void setRotationsAndTRanslations(double aArray[]);\n-    void getRotationsAndTranslationsAsArray6(double aArray[]) const\n-    {\n-            SimTK::Vec3 translations = _transform.p();\n-            SimTK::Vec3 rotations = _transform.R().convertRotationToBodyFixedXYZ();\n-            int i=0;\n-            for(i=0; i<3; i++){\n-                aArray[i] = rotations[i];\n-                aArray[i+3] = translations[i];\n-            }\n-    }\n-    SimTK::Vec3&    getScaleFactors() const { return _scaleFactors; };\n-    void getScaleFactors(double aScaleFactors[]) const {\n-        SimTK::Vec3::updAs(aScaleFactors) = getScaleFactors();\n-    } \n-    void setScaleFactors(const double aScaleFactors[]){\n-        setScaleFactors(SimTK::Vec3::getAs(aScaleFactors));\n-    }\n-    void setScaleFactors(const SimTK::Vec3& aScaleFactors) { _scaleFactors=aScaleFactors; };\n-\n-    DisplayPreference getDisplayPreference() const { return _displayPreference; };\n-    void setDisplayPreference(const DisplayPreference& aPreference) { _displayPreference=aPreference; };\n-\n-    double getOpacity() const { return _opacity; };\n-    void setOpacity(const double& aOpacity) { _opacity=aOpacity; };\n-\n-//=============================================================================\n-};  // END of class DisplayGeometry\n-\n-\n-}; //namespace\n-//=============================================================================\n-//=============================================================================\n-\n-#endif //__DisplayGeometry_h__\ndiff --git a/OpenSim/Common/Geometry.h b/OpenSim/Common/Geometry.h\nindex 6d54d1045..16ee8fa99 100644\n--- a/OpenSim/Common/Geometry.h\n+++ b/OpenSim/Common/Geometry.h\n@@ -24,6 +24,7 @@\n  * -------------------------------------------------------------------------- */\n \n #include "SimTKcommon.h"\n+#include "osimCommonDLL.h"\n \n // Geometry.h\n // Authors: Ayman Habib\n@@ -32,15 +33,15 @@\n * Copyright (c)  2005, Stanford University. All rights reserved. \n * Use of the OpenSim software in source form is permitted provided that the following\n * conditions are met:\n-*   1. The software is used only for non-commercial research and education. It may not\n+* \t1. The software is used only for non-commercial research and education. It may not\n *     be used in relation to any commercial activity.\n-*   2. The software is not distributed or redistributed.  Software distribution is allowed \n+* \t2. The software is not distributed or redistributed.  Software distribution is allowed \n *     only through https://simtk.org/home/opensim.\n-*   3. Use of the OpenSim software or derivatives must be acknowledged in all publications,\n+* \t3. Use of the OpenSim software or derivatives must be acknowledged in all publications,\n *      presentations, or documents describing work in which OpenSim or derivatives are used.\n-*   4. Credits to developers may not be removed from executables\n+* \t4. Credits to developers may not be removed from executables\n *     created from modifications of the source.\n-*   5. Modifications of source code must retain the above copyright notice, this list of\n+* \t5. Modifications of source code must retain the above copyright notice, this list of\n *     conditions and the following disclaimer. \n * \n *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\n@@ -77,49 +78,49 @@ namespace OpenSim {\n class OSIMCOMMON_API Geometry\n {\n public:\n-    // Basically subtypes so that we can do dynamic casting safely on GUI side, based on type\n-    enum GeometryType{\n-        None, Sphere,  Cylinder, Cone, Ellipsoid, Torus, Line, Arrow    \n-    };\n+\t// Basically subtypes so that we can do dynamic casting safely on GUI side, based on type\n+\tenum GeometryType{\n+\t\tNone, Sphere,  Cylinder, Cone, Ellipsoid, Torus, Line, Arrow\t\n+\t};\n private:\n-    bool            _fixed; /** to indicate if the geometry is fixed vs deformable */\n+\tbool\t\t\t_fixed; /** to indicate if the geometry is fixed vs deformable */\n protected:\n-    GeometryType    _analyticType;\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n+\tGeometryType\t_analyticType;\n+\t//--------------------------------------------------------------------------\n+\t// CONSTRUCTION\n+\t//--------------------------------------------------------------------------\n public:\n-    Geometry():\n-    _fixed(true),\n-    _analyticType(None)\n-    {}\n-    virtual ~Geometry() {}\n-    //=============================================================================\n-    // METHODS\n-    //=============================================================================\n-    // Retrieve analytic type\n-    const GeometryType getShape() const\n-    {\n-        return _analyticType;\n-    }\n-    // Check if the geometry corresponds to an analytic geometry\n-    virtual bool isAnalytic() const\n-    {\n-        return _analyticType!=None;\n-    }\n-    // Mark geometry as Fixed (so that vtk resources are allocated once,\n-    // potentially use the same vtkGeometry more than once.)\n-    virtual void setFixed(bool aFixed)\n-    {\n-        _fixed = aFixed;\n-    }\n-    virtual bool getFixed() const\n-    {\n-        return _fixed;\n-    }\n+\tGeometry():\n+\t_fixed(true),\n+\t_analyticType(None)\n+\t{}\n+\tvirtual ~Geometry() {}\n+\t//=============================================================================\n+\t// METHODS\n+\t//=============================================================================\n+\t// Retrieve analytic type\n+\tconst GeometryType getShape() const\n+\t{\n+\t\treturn _analyticType;\n+\t}\n+\t// Check if the geometry corresponds to an analytic geometry\n+\tvirtual bool isAnalytic() const\n+\t{\n+\t\treturn _analyticType!=None;\n+\t}\n+\t// Mark geometry as Fixed (so that vtk resources are allocated once,\n+\t// potentially use the same vtkGeometry more than once.)\n+\tvoid setFixed(bool aFixed)\n+\t{\n+\t\t_fixed = aFixed;\n+\t}\n+\tbool getFixed() const\n+\t{\n+\t\treturn _fixed;\n+\t}\n \n //=============================================================================\n-};  // END of class Geometry\n+};\t// END of class Geometry\n \n /***\n  * LineGeometry is a utility class used to abstract a line segment.\n@@ -127,56 +128,56 @@ public:\n  * For muscle segments, GUI is free to display it as a line, cylinder or ellipsoid\n  */\n class OSIMCOMMON_API LineGeometry : public Geometry\n-{   \n+{\t\n protected:\n-    SimTK::Vec3 _point1;\n-    SimTK::Vec3 _point2;\n+\tSimTK::Vec3 _point1;\n+\tSimTK::Vec3 _point2;\n public:\n-    LineGeometry(SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2):\n-      Geometry()\n-    {\n-        _analyticType=Line;\n-        _point1 = aPoint1;\n-        _point2 = aPoint2;\n-    }\n-    LineGeometry():\n-      Geometry(),\n-      _point1(0.0),\n-      _point2(0.0)\n-    {\n-        _analyticType=Line;\n-    }\n-    virtual ~LineGeometry() {}\n-    // Get & Set end points\n-    void getPoints(SimTK::Vec3& rPoint1, SimTK::Vec3& rPoint2) const \n-    {\n-        rPoint1 = _point1;\n-        rPoint2 = _point2;\n-    }\n-    void getPoints(double rPoint1[], double rPoint2[]) const // A variant that uses basic types for use by GUI\n-    {\n-        getPoints(SimTK::Vec3::updAs(rPoint1), SimTK::Vec3::updAs(rPoint2));\n-    }\n-    void setPoints(SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2)\n-    {\n-        _point1 = aPoint1;\n-        _point2 = aPoint2;\n-    }\n-    void setPoints(double aPoint1[], double aPoint2[])  // A variant that uses basic types for use by GUI\n-    {\n-        setPoints(SimTK::Vec3::updAs(aPoint1), SimTK::Vec3::updAs(aPoint2));\n-    }\n+\tLineGeometry(SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2):\n+\t  Geometry()\n+\t{\n+\t\t_analyticType=Line;\n+\t\t_point1 = aPoint1;\n+\t\t_point2 = aPoint2;\n+\t}\n+\tLineGeometry():\n+\t  Geometry(),\n+\t  _point1(0.0),\n+\t  _point2(0.0)\n+\t{\n+\t\t_analyticType=Line;\n+\t}\n+\tvirtual ~LineGeometry() {}\n+\t// Get & Set end points\n+\tvoid getPoints(SimTK::Vec3& rPoint1, SimTK::Vec3& rPoint2) const \n+\t{\n+\t\trPoint1 = _point1;\n+\t\trPoint2 = _point2;\n+\t}\n+\tvoid getPoints(double rPoint1[], double rPoint2[]) const // A variant that uses basic types for use by GUI\n+\t{\n+\t\tgetPoints(SimTK::Vec3::updAs(rPoint1), SimTK::Vec3::updAs(rPoint2));\n+\t}\n+\tvoid setPoints(SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2)\n+\t{\n+\t\t_point1 = aPoint1;\n+\t\t_point2 = aPoint2;\n+\t}\n+\tvoid setPoints(double aPoint1[], double aPoint2[])\t// A variant that uses basic types for use by GUI\n+\t{\n+\t\tsetPoints(SimTK::Vec3::updAs(aPoint1), SimTK::Vec3::updAs(aPoint2));\n+\t}\n };\n \n class OSIMCOMMON_API ArrowGeometry : public LineGeometry\n-{   \n+{\t\n public:\n-    ArrowGeometry(SimTK::Vec3& aPoint1, SimTK::Vec3& aUnitDirTo, double aLength):\n-      LineGeometry(aPoint1, /* aPoint1+aLength* */aUnitDirTo)\n-    {\n-        _analyticType = Arrow;\n-    }\n-    virtual ~ArrowGeometry() {}\n+\tArrowGeometry(SimTK::Vec3& aPoint1, SimTK::Vec3& aUnitDirTo, double aLength):\n+\t  LineGeometry(aPoint1, /* aPoint1+aLength* */aUnitDirTo)\n+\t{\n+\t\t_analyticType = Arrow;\n+\t}\n+\tvirtual ~ArrowGeometry() {}\n };\n \n \n@@ -187,168 +188,168 @@ public:\n  * one per shape.\n  */\n class OSIMCOMMON_API AnalyticGeometry : public Geometry\n-{    \n+{\t \n \n-    // Common array of attributes for analytic geometry we can represent\n-    // Meaning depends on _analyticType as follows.\n-    // Amended with a quadrants array to support pieces of analytic geometry (for wrapping)\n-    // Sphere   [Radius, unused, unused, unused, unused, unused]\n-    // Cylinder  [Radius, Height, unused, ...]\n-    // Cone      [BaseRadius, TopRadius, Height, unused, ..]\n-    // Ellipsoid [AxisLength1, AxisLength2, AxisLength3, unused, ..]\n+\t// Common array of attributes for analytic geometry we can represent\n+\t// Meaning depends on _analyticType as follows.\n+\t// Amended with a quadrants array to support pieces of analytic geometry (for wrapping)\n+\t// Sphere\t[Radius, unused, unused, unused, unused, unused]\n+\t// Cylinder  [Radius, Height, unused, ...]\n+\t// Cone\t\t [BaseRadius, TopRadius, Height, unused, ..]\n+\t// Ellipsoid [AxisLength1, AxisLength2, AxisLength3, unused, ..]\n private:\n-    bool                    _bounds[6];     //-X, +X, -Y, +Y, -Z, +Z\n-    bool                    _piece;\n+\tbool\t\t\t\t\t_bounds[6];\t\t//-X, +X, -Y, +Y, -Z, +Z\n+\tbool\t\t\t\t\t_piece;\n public:\n-    AnalyticGeometry(GeometryType aGeometricType):\n-        _piece(false)\n-    {\n-        _analyticType=aGeometricType;\n-        for(int i=0; i<6; i++) _bounds[i]=true;\n-    }\n-    virtual ~AnalyticGeometry() {}\n-    void setQuadrants(const bool quadrants[6])\n-    {\n-        _piece=false;\n-        for(int i=0; i<6; i++){\n-            _bounds[i]=quadrants[i];\n-            _piece = _piece || (!quadrants[i]);\n-        }\n-    }\n-    void getQuadrants(bool quadrants[6])\n-    {\n-        for(int i=0; i<6; i++){\n-            quadrants[i]=_bounds[i];\n-        }\n-    }\n-    const bool isPiece() const\n-    {\n-        return _piece;\n-    }\n+\tAnalyticGeometry(GeometryType aGeometricType):\n+\t\t_piece(false)\n+\t{\n+\t\t_analyticType=aGeometricType;\n+\t\tfor(int i=0; i<6; i++) _bounds[i]=true;\n+\t}\n+\tvirtual ~AnalyticGeometry() {}\n+\tvoid setQuadrants(const bool quadrants[6])\n+\t{\n+\t\t_piece=false;\n+\t\tfor(int i=0; i<6; i++){\n+\t\t\t_bounds[i]=quadrants[i];\n+\t\t\t_piece = _piece || (!quadrants[i]);\n+\t\t}\n+\t}\n+\tvoid getQuadrants(bool quadrants[6])\n+\t{\n+\t\tfor(int i=0; i<6; i++){\n+\t\t\tquadrants[i]=_bounds[i];\n+\t\t}\n+\t}\n+\tconst bool isPiece() const\n+\t{\n+\t\treturn _piece;\n+\t}\n };\n \n class OSIMCOMMON_API AnalyticSphere : public AnalyticGeometry\n {\n protected:\n-    double              _attributes[1];\n+\tdouble\t\t\t\t_attributes[1];\n public:\n-    AnalyticSphere():\n-        AnalyticGeometry(Sphere)\n-        {}\n-    AnalyticSphere(double radius):\n-        AnalyticGeometry(Sphere)\n-        {\n-            _attributes[0] = radius;\n-        }\n-    virtual ~AnalyticSphere() {}\n-    const double& getRadius() const\n-    {\n-        //assert(_analyticType==Sphere);\n-        return _attributes[0];\n-    }\n-    void setSphereRadius(double radius)\n-    {\n-        //assert(_analyticType==Sphere);\n-            _attributes[0] = radius;        \n-    }\n-    static AnalyticGeometry* createSphere(double radius)\n-    {\n-        AnalyticSphere* sphere = new AnalyticSphere();\n-        sphere->setSphereRadius(radius);\n-        return sphere;\n-    }\n-};  // AnalyticSphere\n+\tAnalyticSphere():\n+\t\tAnalyticGeometry(Sphere)\n+\t\t{}\n+\tAnalyticSphere(double radius):\n+\t\tAnalyticGeometry(Sphere)\n+\t\t{\n+\t\t\t_attributes[0] = radius;\n+\t\t}\n+\tvirtual ~AnalyticSphere() {}\n+\tconst double& getRadius() const\n+\t{\n+\t\t//assert(_analyticType==Sphere);\n+\t\treturn _attributes[0];\n+\t}\n+\tvoid setSphereRadius(double radius)\n+\t{\n+\t\t//assert(_analyticType==Sphere);\n+\t\t\t_attributes[0] = radius;\t\t\n+\t}\n+\tstatic AnalyticGeometry* createSphere(double radius)\n+\t{\n+\t\tAnalyticSphere* sphere = new AnalyticSphere();\n+\t\tsphere->setSphereRadius(radius);\n+\t\treturn sphere;\n+\t}\n+};\t// AnalyticSphere\n \n class OSIMCOMMON_API AnalyticEllipsoid : public AnalyticGeometry\n {\n protected:\n-    double              _attributes[3];\n+\tdouble\t\t\t\t_attributes[3];\n public:\n-    AnalyticEllipsoid():\n-        AnalyticGeometry(Ellipsoid)\n-        {}\n-    AnalyticEllipsoid(double radius1, double radius2, double radius3):\n-        AnalyticGeometry(Ellipsoid){\n-            _attributes[0] = radius1;\n-            _attributes[1] = radius2;\n-            _attributes[2] = radius3;\n-    }\n-    virtual ~AnalyticEllipsoid() {}\n-    void setEllipsoidParams(double radius1, double radius2, double radius3)\n-    {\n-        //assert(_analyticType==Sphere);\n-        _attributes[0] = radius1;\n-        _attributes[1] = radius2;\n-        _attributes[2] = radius3;\n-    }\n-    void getEllipsoidParams(double params[])\n-    {\n-        //assert(_analyticType==Ellipsoid);\n-        for(int i=0;i<3; i++)\n-            params[i] = _attributes[i];\n-    }\n+\tAnalyticEllipsoid():\n+\t\tAnalyticGeometry(Ellipsoid)\n+\t\t{}\n+\tAnalyticEllipsoid(double radius1, double radius2, double radius3):\n+\t\tAnalyticGeometry(Ellipsoid){\n+\t\t\t_attributes[0] = radius1;\n+\t\t\t_attributes[1] = radius2;\n+\t\t\t_attributes[2] = radius3;\n+\t}\n+\tvirtual ~AnalyticEllipsoid() {}\n+\tvoid setEllipsoidParams(double radius1, double radius2, double radius3)\n+\t{\n+\t\t//assert(_analyticType==Sphere);\n+\t\t_attributes[0] = radius1;\n+\t\t_attributes[1] = radius2;\n+\t\t_attributes[2] = radius3;\n+\t}\n+\tvoid getEllipsoidParams(double params[])\n+\t{\n+\t\t//assert(_analyticType==Ellipsoid);\n+\t\tfor(int i=0;i<3; i++)\n+\t\t\tparams[i] = _attributes[i];\n+\t}\n };\n \n class OSIMCOMMON_API AnalyticCylinder : public AnalyticGeometry\n {\n protected:\n-    double              _attributes[2];\n+\tdouble\t\t\t\t_attributes[2];\n public:\n-    AnalyticCylinder():\n-        AnalyticGeometry(Cylinder)\n-        {}\n-    AnalyticCylinder(const double radius, const double height):\n-        AnalyticGeometry(Cylinder)\n-        {\n-            _attributes[0]=radius;\n-            _attributes[1]=height;\n-        }\n-    virtual ~AnalyticCylinder() {}\n-    void getCylinderParams(double params[]) const\n-    {\n-        //assert(_analyticType==Cylinder);\n-        params[0] = _attributes[0];\n-        params[1] = _attributes[1];\n-    }\n+\tAnalyticCylinder():\n+\t\tAnalyticGeometry(Cylinder)\n+\t\t{}\n+\tAnalyticCylinder(const double radius, const double height):\n+\t\tAnalyticGeometry(Cylinder)\n+\t\t{\n+\t\t\t_attributes[0]=radius;\n+\t\t\t_attributes[1]=height;\n+\t\t}\n+\tvirtual ~AnalyticCylinder() {}\n+\tvoid getCylinderParams(double params[]) const\n+\t{\n+\t\t//assert(_analyticType==Cylinder);\n+\t\tparams[0] = _attributes[0];\n+\t\tparams[1] = _attributes[1];\n+\t}\n };\n \n class OSIMCOMMON_API AnalyticTorus : public AnalyticGeometry\n {\n protected:\n-    double              _attributes[2];\n+\tdouble\t\t\t\t_attributes[2];\n public:\n-    AnalyticTorus():\n-        AnalyticGeometry(Torus)\n-        {}\n-    AnalyticTorus(const double ringRadius, const double crossSectionRadius):\n-        AnalyticGeometry(Torus)\n-        {\n-            _attributes[0]=ringRadius;\n-            _attributes[1]=crossSectionRadius;\n-        }\n-    virtual ~AnalyticTorus() {}\n-    void getTorusParams(double params[]) const\n-    {\n-        //assert(_analyticType==Torus);\n-        params[0] = _attributes[0];\n-        params[1] = _attributes[1];\n-    }\n+\tAnalyticTorus():\n+\t\tAnalyticGeometry(Torus)\n+\t\t{}\n+\tAnalyticTorus(const double ringRadius, const double crossSectionRadius):\n+\t\tAnalyticGeometry(Torus)\n+\t\t{\n+\t\t\t_attributes[0]=ringRadius;\n+\t\t\t_attributes[1]=crossSectionRadius;\n+\t\t}\n+\tvirtual ~AnalyticTorus() {}\n+\tvoid getTorusParams(double params[]) const\n+\t{\n+\t\t//assert(_analyticType==Torus);\n+\t\tparams[0] = _attributes[0];\n+\t\tparams[1] = _attributes[1];\n+\t}\n };\n \n class OSIMCOMMON_API PolyhedralGeometry : public Geometry\n {\n protected:\n-    std::string _geometryFile;\n+\tstd::string _geometryFile;\n public:\n-    PolyhedralGeometry(const std::string& geomFile):\n-        Geometry()\n-        {\n-            _geometryFile = geomFile;\n-        }\n-    const std::string&  getGeometryFilename() const\n-    {\n-        return _geometryFile;\n-    };\n+\tPolyhedralGeometry(const std::string& geomFile):\n+\t\tGeometry()\n+\t\t{\n+\t\t\t_geometryFile = geomFile;\n+\t\t}\n+\tconst std::string&  getGeometryFilename() const\n+\t{\n+\t\treturn _geometryFile;\n+\t};\n \n };\n \ndiff --git a/OpenSim/Common/GeometrySet.h b/OpenSim/Common/GeometrySet.h\ndeleted file mode 100644\nindex e33ebec90..000000000\n--- a/OpenSim/Common/GeometrySet.h\n+++ /dev/null\n@@ -1,64 +0,0 @@\n-#ifndef _GeometrySet_h_\n-#define _GeometrySet_h_\n-/* -------------------------------------------------------------------------- *\n- *                          OpenSim:  GeometrySet.h                           *\n- * -------------------------------------------------------------------------- *\n- * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *\n- * See http://opensim.stanford.edu and the NOTICE file for more information.  *\n- * OpenSim is developed at Stanford University and supported by the US        *\n- * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *\n- * through the Warrior Web program.                                           *\n- *                                                                            *\n- * Copyright (c) 2005-2012 Stanford University and the Authors                *\n- *                                                                            *\n- * Licensed under the Apache License, Version 2.0 (the "License"); you may    *\n- * not use this file except in compliance with the License. You may obtain a  *\n- * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *\n- *                                                                            *\n- * Unless required by applicable law or agreed to in writing, software        *\n- * distributed under the License is distributed on an "AS IS" BASIS,          *\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *\n- * See the License for the specific language governing permissions and        *\n- * limitations under the License.                                             *\n- * -------------------------------------------------------------------------- */\n-\n-/*  \n- * Author:  \n- */\n-\n-#include "osimCommonDLL.h"\n-#include "Object.h"\n-#include "DisplayGeometry.h"\n-#include "Set.h"\n-\n-namespace OpenSim { \n-\n-class OSIMCOMMON_API GeometrySet :  public Set<DisplayGeometry> {\n-OpenSim_DECLARE_CONCRETE_OBJECT(GeometrySet, Set<DisplayGeometry>);\n-\n-public:\n-    GeometrySet() {}\n-    virtual ~GeometrySet() {}\n-\n-#ifndef SWIG\n-    GeometrySet& operator=(const GeometrySet& aGeometrySet) { \n-        Set<DisplayGeometry>::operator=(aGeometrySet);\n-        return (*this);\n-    };\n-\n-    bool operator==(const GeometrySet& aGeometrySet) { \n-        bool sizeMatch = (getSize()==aGeometrySet.getSize()); \n-        if (!sizeMatch) return false;\n-        bool match=true;\n-        for(int i=0; i< getSize() && match; i++)\n-            match = (get(i)==aGeometrySet[i]);\n-        return match;\n-    };\n-#endif\n-};\n-\n-}; //namespace\n-//=============================================================================\n-//=============================================================================\n-\n-#endif //__GeometrySet_h__\ndiff --git a/OpenSim/Common/Object.h b/OpenSim/Common/Object.h\nindex 16ab0c31e..a942e24a4 100644\n--- a/OpenSim/Common/Object.h\n+++ b/OpenSim/Common/Object.h\n@@ -57,21 +57,21 @@ template class OSIMCOMMON_API OpenSim::ArrayPtrs<OpenSim::Object>;\n \n \n #ifdef SWIG\n-    #ifdef OSIMCOMMON_API\n-        #undef OSIMCOMMON_API\n-    #endif\n-    #define OSIMCOMMON_API\n-    #ifdef override\n-        #undef override\n-    #endif\n-    #define override\n+\t#ifdef OSIMCOMMON_API\n+\t\t#undef OSIMCOMMON_API\n+\t#endif\n+\t#define OSIMCOMMON_API\n+\t#ifdef override\n+\t\t#undef override\n+\t#endif\n+\t#define override\n     #ifdef final\n         #undef final\n-    #endif\n+\t#endif\n     #define final\n-    #define SWIG_DECLARE_EXCEPTION throw(OpenSim::Exception)\n+\t#define SWIG_DECLARE_EXCEPTION throw(OpenSim::Exception)\n #else\n-    #define SWIG_DECLARE_EXCEPTION\n+\t#define SWIG_DECLARE_EXCEPTION\n #endif\n \n \n@@ -80,7 +80,6 @@ namespace OpenSim {\n // CONSTANTS\n const char ObjectDEFAULT_NAME[] = "default";\n \n-class VisibleObject;\n class XMLDocument;\n \n //==============================================================================\n@@ -200,12 +199,12 @@ public:\n     // Constructors are protected.\n \n \n-    /**\n-     * Virtual destructor for cleanup\n-     */\n-    virtual ~Object();\n+\t/**\n+\t * Virtual destructor for cleanup\n+\t */\n+\tvirtual ~Object();\n \n-    /** Create a new heap-allocated copy of the concrete object to which this \n+\t/** Create a new heap-allocated copy of the concrete object to which this \n     %Object refers. It is up to the caller to delete the returned object\n     when no longer needed. Every concrete object deriving from %Object \n     implements this pure virtual method automatically, via the declaration\n@@ -213,7 +212,7 @@ public:\n     concrete class overrides modify the return type to be a pointer to the\n     \\e concrete object; that still overrides the base class method because the \n     return type is covariant with (that is, derives from) %Object. **/\n-    virtual Object* clone() const = 0;\n+\tvirtual Object* clone() const = 0;\n \n     /** Returns the class name of the concrete %Object-derived class of the\n     actual object referenced by this %Object, as a string. This is the \n@@ -225,77 +224,67 @@ public:\n     @see getClassName() **/\n     virtual const std::string& getConcreteClassName() const = 0;\n \n-    /**\n-     * Methods to support making the object displayable in the GUI or Visualizer\n-     * Implemented only in few objects\n-     */\n-    /** Get const pointer to VisibleObject that contains geometry */\n-    virtual const VisibleObject *getDisplayer() const { return 0; };\n-    /** get Non const pointer to VisibleObject */\n-    virtual VisibleObject *updDisplayer() { return 0; };\n-\n-\n-    //--------------------------------------------------------------------------\n-    // OPERATORS\n-    //--------------------------------------------------------------------------\n-    /**\n-     * Equality operator wrapper for use from languages not supporting operator\n+\t//--------------------------------------------------------------------------\n+\t// OPERATORS\n+\t//--------------------------------------------------------------------------\n+\t/**\n+\t * Equality operator wrapper for use from languages not supporting operator\n      * overloading.\n-     */\n-    bool isEqualTo(const Object &aObject) const\n-    {\n-        return ((*this)==aObject);\n-    }\n+\t */\n+\tbool isEqualTo(const Object &aObject) const\n+\t{\n+\t\treturn ((*this)==aObject);\n+\t}\n \n     #ifndef SWIG\n     /** Copy assignment copies he base class fields, including the \n     properties. **/\n-    Object& operator=(const Object &aObject);\n+\tObject& operator=(const Object &aObject);\n     /** Determine if two objects are equal. They are equal if all the simple\n     base class members are equal, both objects have the same number of \n     properties and corresponding properties are equal, and if the objects\n     are the same concrete type and the concrete class says they are equal. \n     Concrete object classes must override this if they have any fields to\n     compare, but be sure to invoke the base class operator too. **/\n-    virtual bool operator==(const Object &aObject) const;\n+\tvirtual bool operator==(const Object &aObject) const;\n     /** Provide an ordering for objects so they can be put in sorted\n     containers. **/\n-    virtual bool operator<(const Object &aObject) const;\n+\tvirtual bool operator<(const Object &aObject) const;\n     /** Write the type and name of this object into the given output stream. **/\n-    friend std::ostream& operator<<(std::ostream &aOut,\n-                                    const Object &aObject) {\n-        aOut << aObject.getConcreteClassName() << " " << aObject.getName();\n-        return(aOut);\n-    };\n+\tfriend std::ostream& operator<<(std::ostream &aOut,\n+\t\t\t\t\t\t\t\t\tconst Object &aObject) {\n+\t\taOut << aObject.getConcreteClassName() << " " << aObject.getName();\n+\t\treturn(aOut);\n+\t};\n     #endif\n \n-    //--------------------------------------------------------------------------\n-    // GET AND SET\n-    //--------------------------------------------------------------------------\n-    /** Set the name of the Object. */\n-    void setName(const std::string& name);\n-    /** Get the name of this Object. */\n-    const std::string& getName() const;\n-    /** Set description, a one-liner summary. */\n-    void setDescription(const std::string& description);\n-    /** Get description, a one-liner summary. */\n-    const std::string& getDescription() const;\n-\n-    /** Get Authors of this Object */\n-    const std::string& getAuthors() const { return _authors; };\n-    /** Set Authors of this object, call this method in your constructor if needed */\n-    void setAuthors(const std::string& authors) { _authors=authors; };\n-\n-    /** Get references or publications to cite if using this object. */\n-    const std::string& getReferences() const { return _references; };\n-    /** Set references or publications to cite if using this object. */\n-    void setReferences(const std::string& references) \n+\t//--------------------------------------------------------------------------\n+\t// GET AND SET\n+\t//--------------------------------------------------------------------------\n+\t/** Set the name of the Object. */\n+\tvoid setName(const std::string& name);\n+\t/** Get the name of this Object. */\n+\tconst std::string& getName() const;\n+\t/** Set description, a one-liner summary. */\n+\tvoid setDescription(const std::string& description);\n+\t/** Get description, a one-liner summary. */\n+\tconst std::string& getDescription() const;\n+\n+\t/** Get Authors of this Object */\n+\tconst std::string& getAuthors() const { return _authors; };\n+\t/** Set Authors of this object, call this method in your constructor if needed */\n+\tvoid setAuthors(const std::string& authors) { _authors=authors; };\n+\n+\t/** Get references or publications to cite if using this object. */\n+\tconst std::string& getReferences() const { return _references; };\n+\t/** Set references or publications to cite if using this object. */\n+\tvoid setReferences(const std::string& references) \n     {   _references=references; };\n \n \n-    //--------------------------------------------------------------------------\n-    // PUBLIC ACCESS TO PROPERTIES\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// PUBLIC ACCESS TO PROPERTIES\n+\t//--------------------------------------------------------------------------\n     /** @name              Public access to properties\n     Methods in this section are for public access to the properties maintained\n     by this OpenSim %Object. Properties are normally accessed through methods\n@@ -340,16 +329,16 @@ public:\n     addProperty<T>(). **/\n     template <class T> bool hasProperty() const;\n \n-    /** Get property of known type Property\\<T> as a const reference; \n+\t/** Get property of known type Property\\<T> as a const reference; \n     the property must be present and have the right type. This is primarily\n     used by the Property declaration macros for fast access to properties. **/\n-    template <class T> const Property<T>& \n+\ttemplate <class T> const Property<T>& \n     getProperty(const PropertyIndex& index) const;\n \n-    /** Get property of known type Property\\<T> as a writable reference;\n+\t/** Get property of known type Property\\<T> as a writable reference;\n     the property must be present and have the right type. This is primarily\n     used by the Property declaration macros for fast access to properties. **/\n-    template <class T> Property<T>& \n+\ttemplate <class T> Property<T>& \n     updProperty(const PropertyIndex& index);\n \n     /** Returns \\c true if no property\'s value has changed since the last time\n@@ -372,21 +361,21 @@ public:\n         class is printed. If ClassName is empty, the information for the \n         properties of all registered classes is printed.\n     **/\n-    static void PrintPropertyInfo(std::ostream&      os,\n-                                  const std::string& classNameDotPropertyName);\n+\tstatic void PrintPropertyInfo(std::ostream&      os,\n+\t\t\t\t\t              const std::string& classNameDotPropertyName);\n     /** Same as the other signature but the class name and property name are\n     provided as two separate strings. **/\n-    static void PrintPropertyInfo(std::ostream&         os,\n-                                  const std::string&    className,\n+\tstatic void PrintPropertyInfo(std::ostream&         os,\n+\t\t\t\t\t              const std::string&    className,\n                                   const std::string&    propertyName);\n     /**@}**/\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n \n \n-    //--------------------------------------------------------------------------\n-    // REGISTRATION OF TYPES AND DEFAULT OBJECTS\n-    //--------------------------------------------------------------------------\n-    /** @name          Registration of types and default objects\n+\t//--------------------------------------------------------------------------\n+\t// REGISTRATION OF TYPES AND DEFAULT OBJECTS\n+\t//--------------------------------------------------------------------------\n+\t/** @name          Registration of types and default objects\n     Methods in this section deal with the requirement that all %OpenSim \n     types derived from %Object must be registered and a default instance\n     provided. This enables reading these objects from XML files. You can also\n@@ -403,14 +392,14 @@ public:\n     supplied %Object is used as the default value for objects of this type when \n     created (typically during the deserialization process when reading an \n     XML file). **/\n-    static void registerType(const Object& defaultObject);\n+\tstatic void registerType(const Object& defaultObject);\n \n-    /** Support versioning by associating the current %Object type with an \n+\t/** Support versioning by associating the current %Object type with an \n     old name. This is only allowed if \\a newTypeName has already been \n     registered with registerType(). Renaming is applied first prior to lookup\n     so can be used both for translating now-obsolete names to their new names\n     and for overriding one registered type with another. **/\n-    static void renameType(const std::string& oldTypeName, \n+\tstatic void renameType(const std::string& oldTypeName, \n                            const std::string& newTypeName);\n \n     /** Return a pointer to the default instance of the registered (concrete)\n@@ -437,19 +426,19 @@ public:\n     @see registerType(), renameType() **/\n     template <class T> static bool\n     isObjectTypeDerivedFrom(const std::string& concreteClassName) {\n-        const Object* defObj = getDefaultInstanceOfType(concreteClassName);\n+    \tconst Object* defObj = getDefaultInstanceOfType(concreteClassName);\n         if (defObj == NULL) return false;\n         return dynamic_cast<const T*>(defObj) != NULL;\n     }\n \n-    /** Create a new instance of the concrete %Object type whose class name is \n+\t/** Create a new instance of the concrete %Object type whose class name is \n     given as \\a concreteClassName. The instance is initialized to the default \n     object of corresponding type, possibly after renaming to the current class \n     name. Writes a message to stderr and returns null if the tag isn\'t \n     registered. **/\n-    static Object* newInstanceOfType(const std::string& concreteClassName);\n+\tstatic Object* newInstanceOfType(const std::string& concreteClassName);\n \n-    /** Retrieve all the typenames registered so far. This is done by traversing\n+\t/** Retrieve all the typenames registered so far. This is done by traversing\n     the registered objects map, so only concrete classes that have registered \n     instances are returned; renamed types will not appear unless they were\n     separately registered. (Note that even if one registered type has been\n@@ -457,27 +446,27 @@ public:\n     returned in \\a typeNames should not be cached while more shared libraries \n     or plugins are loaded, because more types may be registered as a result. \n     Instead the list should be reconstructed whenever in doubt. **/\n-    static void getRegisteredTypenames(Array<std::string>& typeNames);\n+\tstatic void getRegisteredTypenames(Array<std::string>& typeNames);\n \n-    /** Return an array of pointers to the default instances of all registered\n+\t/** Return an array of pointers to the default instances of all registered\n     (concrete) %Object types that derive from a given %Object-derived type \n     that does not have to be concrete. This is useful, for example, to find \n     all Joints, Constraints, ModelComponents, Analyses, etc. **/\n-    template<class T> static void \n+\ttemplate<class T> static void \n     getRegisteredObjectsOfGivenType(ArrayPtrs<T>& rArray) {\n-        rArray.setSize(0);\n-        rArray.setMemoryOwner(false);\n-        for(int i=0; i<_registeredTypes.getSize(); i++) {\n+\t\trArray.setSize(0);\n+\t\trArray.setMemoryOwner(false);\n+\t\tfor(int i=0; i<_registeredTypes.getSize(); i++) {\n             T* obj = dynamic_cast<T*>(_registeredTypes[i]);\n             if (obj) rArray.append(obj);\n         }\n-    }\n+\t}\n     /**@}**/\n \n-    //--------------------------------------------------------------------------\n-    // XML\n-    //--------------------------------------------------------------------------\n-    /** @name                  XML reading and writing\n+\t//--------------------------------------------------------------------------\n+\t// XML\n+\t//--------------------------------------------------------------------------\n+\t/** @name                  XML reading and writing\n     These methods deal with writing out in-memory objects to XML files\n     (serializing) and reading XML files to reconstruct in-memory objects\n     (deserializing). **/\n@@ -487,7 +476,7 @@ public:\n     %Object doesn\'t have the proper type info. This works by using the defaults \n     table so that %Object does not need to know about its derived classes. It \n     uses the defaults table to get an instance. **/\n-    static Object* makeObjectFromFile(const std::string& fileName);\n+\tstatic Object* makeObjectFromFile(const std::string& fileName);\n \n     /** We\'re given an XML element from which we are to populate this %Object.\n     If the element has a \\c file attribute, we\'ll instead read the %Object from\n@@ -496,16 +485,16 @@ public:\n     be interpreted relative to the current working directory, but that will\n     normally have been set earlier to the directory containing the top-level \n     (root) %Object, such as the Model file. **/\n-    void readObjectFromXMLNodeOrFile\n+\tvoid readObjectFromXMLNodeOrFile\n        (SimTK::Xml::Element& objectElement, \n         int                  versionNumber);\n \n-    /** Use this method to deserialize an object from a SimTK::Xml::Element. The \n+\t/** Use this method to deserialize an object from a SimTK::Xml::Element. The \n     element is assumed to be in the format consistent with the passed-in \n     \\a versionNumber. If there is a file attribute in \\a objectElement it\n     will be ignored; if you want it processed you should call \n     readObjectFromXMLNodeOrFile() instead. **/\n-    virtual void updateFromXMLNode(SimTK::Xml::Element& objectElement, \n+\tvirtual void updateFromXMLNode(SimTK::Xml::Element& objectElement, \n                                    int                  versionNumber);\n \n     /** Serialize this object into the XML node that represents it.   \n@@ -519,14 +508,14 @@ public:\n     **/\n     virtual void updateXMLNode(SimTK::Xml::Element& parent) const;\n \n-    /** Inlined means an in-memory Object that is not associated with\n+\t/** Inlined means an in-memory Object that is not associated with\n     an XMLDocument. **/\n-    bool getInlined() const;\n+\tbool getInlined() const;\n     /** Mark this as inlined or not and optionally provide a file name\n     to associate with the new XMLDocument for the non-inline case. If \n     there was already a document associated with this object it is\n     deleted. **/\n-    void setInlined(bool aInlined, const std::string &aFileName="");\n+\tvoid setInlined(bool aInlined, const std::string &aFileName="");\n \n protected:\n     /** When an object is initialized using the current values of its\n@@ -551,10 +540,10 @@ protected:\n         _objectIsUpToDate = false;\n     }\n \n-    /** Use this method only if you\'re deserializing from a file and the object\n+\t/** Use this method only if you\'re deserializing from a file and the object\n     is at the top level; that is, primarily in constructors that take a file\n     name as input. **/\n-    void updateFromXMLDocument();\n+\tvoid updateFromXMLDocument();\n     /** Unconditionally set the XMLDocument associated with this object.\n     Use carefully -- if there was already a document its heap space is\n     lost here. **/\n@@ -569,10 +558,10 @@ protected:\n public:\n     /** If there is a document associated with this object then return the\n     file name maintained by the document. Otherwise return an empty string. **/\n-    std::string getDocumentFileName() const;\n-    void setAllPropertiesUseDefault(bool aUseDefault);\n+\tstd::string getDocumentFileName() const;\n+\tvoid setAllPropertiesUseDefault(bool aUseDefault);\n \n-    /** Write this %Object into an XML file of the given name; conventionally\n+\t/** Write this %Object into an XML file of the given name; conventionally\n     the suffix to use is ".osim". This is useful for writing out a Model that\n     has been created programmatically, and also very useful for testing and\n     debugging. **/\n@@ -582,9 +571,9 @@ public:\n     Mainly intended for debugging and for use by the XML browser in the GUI. **/\n     std::string dump(bool dumpName=false); \n     /**@}**/\n-    //--------------------------------------------------------------------------\n-    // ADVANCED/OBSCURE/QUESTIONABLE/BUGGY\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// ADVANCED/OBSCURE/QUESTIONABLE/BUGGY\n+\t//--------------------------------------------------------------------------\n     /** @name                      Advanced/Obscure\n     Methods in this section are for specialized purposes not of interest to\n     most OpenSim API users. For example, some of these are services needed by\n@@ -599,57 +588,57 @@ public:\n     static const std::string& getClassName() \n     {   static std::string name ("Object"); return name; }\n \n-    /** Static function to control whether all registered objects and\n+\t/** Static function to control whether all registered objects and\n     their properties are written to the defaults section of output files rather\n     than only those values for which the default was explicitly overwritten\n     when read in from an input file or set programmatically. **/\n-    static void setSerializeAllDefaults(bool shouldSerializeDefaults)\n-    {\n-        _serializeAllDefaults = shouldSerializeDefaults;\n-    }\n+\tstatic void setSerializeAllDefaults(bool shouldSerializeDefaults)\n+\t{\n+\t\t_serializeAllDefaults = shouldSerializeDefaults;\n+\t}\n     /** Report the value of the "serialize all defaults" flag. **/\n-    static bool getSerializeAllDefaults()\n-    {\n-        return _serializeAllDefaults;\n-    }\n+\tstatic bool getSerializeAllDefaults()\n+\t{\n+\t\treturn _serializeAllDefaults;\n+\t}\n \n     /** Returns true if the passed-in string is "Object"; each %Object-derived\n     class defines a method of this name for its own class name. **/\n-    static bool isKindOf(const char *type) \n-    { \n-        return (strcmp("Object",type)==0);\n-    } \n+\tstatic bool isKindOf(const char *type) \n+\t{ \n+\t\treturn (strcmp("Object",type)==0);\n+\t} \n     /** The default implementation returns true only if the supplied string\n     is "Object"; each %Object-derived class overrides this to match its own\n     class name. **/\n-    virtual bool isA(const char *type) const\n-    { \n-        return this->isKindOf(type); \n-    } \n+\tvirtual bool isA(const char *type) const\n+\t{ \n+\t\treturn this->isKindOf(type); \n+\t} \n \n     /** Set the debug level to get verbose output. Zero means no debugging. **/\n-    static void setDebugLevel(int newLevel) {\n-        _debugLevel=newLevel; \n-    };\n+\tstatic void setDebugLevel(int newLevel) {\n+\t\t_debugLevel=newLevel; \n+\t};\n     /** Get current setting of debug level. **/\n-    static int getDebugLevel() {\n-        return _debugLevel; \n-    };\n+\tstatic int getDebugLevel() {\n+\t\treturn _debugLevel; \n+\t};\n \n     /** Wrapper to be used on Java side to display objects in tree; this returns\n     just the object\'s name. **/\n-    const std::string& toString() const;\n+\tconst std::string& toString() const;\n \n     #ifndef SWIG\n-    /** OBSOLETE: Get a reference to the PropertySet maintained by the \n+\t/** OBSOLETE: Get a reference to the PropertySet maintained by the \n     Object. **/\n-    PropertySet& getPropertySet() { return _propertySet; }\n-    const PropertySet& getPropertySet() const { return _propertySet; }\n+\tPropertySet& getPropertySet() { return _propertySet; }\n+\tconst PropertySet& getPropertySet() const { return _propertySet; }\n     #endif\n \n     /** Use the clone() method to duplicate the given object unless the pointer\n     is null in which case null is returned. **/\n-    static Object* SafeCopy(const Object *aObject) \n+\tstatic Object* SafeCopy(const Object *aObject) \n     {   return aObject ? aObject->clone() : 0; }\n \n     /** OBSOLETE alternate name for registerType(). **/\n@@ -660,30 +649,30 @@ public:\n                            const std::string& newName) \n     {   renameType(oldName, newName); }\n     /**@}**/\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n \n //------------------------------------------------------------------------------\n // PROTECTED METHODS\n //------------------------------------------------------------------------------\n protected:\n-    /** The default constructor is only for use by constructors of \n+\t/** The default constructor is only for use by constructors of \n     derived types. Initializes all base class data members to innocuous \n     values. **/\n-    Object();\n+\tObject();\n \n-    /** Constructor from a file, to be called from other constructors that \n+\t/** Constructor from a file, to be called from other constructors that \n     take a file as input. **/\n-    explicit Object(const std::string& fileName, \n+\texplicit Object(const std::string& fileName, \n            bool aUpdateFromXMLNode = true) SWIG_DECLARE_EXCEPTION;\n \n-    /** Copy constructor is invoked automatically by derived classes with\n+\t/** Copy constructor is invoked automatically by derived classes with\n     default copy constructors; otherwise it must be invoked explicitly. **/\n-    Object(const Object& source);\n+\tObject(const Object& source);\n \n-    /** Construct the base class portion of an %Object from a given Xml \n+\t/** Construct the base class portion of an %Object from a given Xml \n     element that describes this Object. Assumes latest XML file format; there\n     is no provision for version numbering. **/\n-    explicit Object(SimTK::Xml::Element& aElement);\n+\texplicit Object(SimTK::Xml::Element& aElement);\n \n \n     /** Define a new single-value property of known type T, with the given \n@@ -699,7 +688,7 @@ protected:\n     @returns Reference to the new Property object stored in this object\'s\n              property table. \n     @see addOptionalProperty(), addListProperty() **/\n-    template <class T> PropertyIndex \n+\ttemplate <class T> PropertyIndex \n     addProperty(const std::string& name, \n                 const std::string& comment, \n                 const T&           value);\n@@ -735,7 +724,7 @@ protected:\n     @returns The PropertyIndex of this property in the proprty table for this\n              object. \n     @see addProperty(), addOptionalProperty() **/\n-    template <class T> PropertyIndex\n+\ttemplate <class T> PropertyIndex\n     addListProperty(const std::string& name, \n                     const std::string& comment,\n                     int minSize, int maxSize);\n@@ -748,7 +737,7 @@ protected:\n     @returns The PropertyIndex of this property in the proprty table for this\n              object. \n     @see addProperty(), addOptionalProperty() **/\n-    template <class T, template<class> class Container> PropertyIndex \n+\ttemplate <class T, template<class> class Container> PropertyIndex \n     addListProperty(const std::string&  name, \n                     const std::string&  comment,\n                     int minSize, int maxSize,\n@@ -779,15 +768,15 @@ protected:\n // PRIVATE METHODS\n //--------------------------------------------------------------------------\n private:\n-    void setNull();\n-    void setupProperties();\n-    void init();\n+\tvoid setNull();\n+\tvoid setupProperties();\n+\tvoid init();\n \n-    // Functions to support deserialization. \n-    void generateXMLDocument();\n+\t// Functions to support deserialization. \n+\tvoid generateXMLDocument();\n \n-    void updateDefaultObjectsFromXMLNode();\n-    void updateDefaultObjectsXMLNode(SimTK::Xml::Element& aParent);\n+\tvoid updateDefaultObjectsFromXMLNode();\n+\tvoid updateDefaultObjectsXMLNode(SimTK::Xml::Element& aParent);\n \n \n //==============================================================================\n@@ -795,78 +784,78 @@ private:\n //==============================================================================\n public:\n     #ifndef SWIG\n-    /** Name used for default objects when they are serialized. */\n-    static const std::string DEFAULT_NAME;\n+\t/** Name used for default objects when they are serialized. */\n+\tstatic const std::string DEFAULT_NAME;\n     #endif\n \n protected:\n-    /** OBSOLETE: Property_Deprecated set for serializable member variables of \n+\t/** OBSOLETE: Property_Deprecated set for serializable member variables of \n     this and derived classes. */\n-    PropertySet _propertySet;\n+\tPropertySet _propertySet;\n \n private:\n-    // Array holding a default value for each of the registered object types. \n+\t// Array holding a default value for each of the registered object types. \n     // Each object type only appears once in this array. Renamed types usually\n     // do not have separate registered objects; they are just used to locate \n     // one of the current ones.\n-    static ArrayPtrs<Object>                    _registeredTypes;\n+\tstatic ArrayPtrs<Object>                    _registeredTypes;\n \n-    // Map from concrete object class name string to a default object of that \n+\t// Map from concrete object class name string to a default object of that \n     // type kept in the above array of registered types. Renamed types are *not* \n     // normally entered here; the names are mapped separately using the map \n     // below.\n-    static std::map<std::string,Object*>        _mapTypesToDefaultObjects;\n+\tstatic std::map<std::string,Object*>        _mapTypesToDefaultObjects;\n \n-    // Map types that have been renamed to their new names, which can\n+\t// Map types that have been renamed to their new names, which can\n     // then be used to find them in the default object map. This lets us \n     // recognize the old names while converting to the new ones internally\n     // so that they will be updated when written out. It also allows one \n     // to map one registered type to a different one programmatically, because\n     // we\'ll look up the name in the rename table first prior to searching\n     // the registered types list.\n-    static std::map<std::string,std::string>    _renamedTypesMap;\n+\tstatic std::map<std::string,std::string>    _renamedTypesMap;\n \n-    // Global flag to indicate if all registered objects are to be written in \n+\t// Global flag to indicate if all registered objects are to be written in \n     // a "defaults" section.\n-    static bool _serializeAllDefaults;\n+\tstatic bool _serializeAllDefaults;\n \n-    // Debug level: \n-    //  0: Hides non fatal warnings \n-    //  1: Shows illegal tags \n-    //  2: level 1 + registration troubleshooting\n-    //  3: 2 + more verbose troubleshooting of Object (de)serialization. When \n+\t// Debug level: \n+\t//\t0: Hides non fatal warnings \n+\t//  1: Shows illegal tags \n+\t//  2: level 1 + registration troubleshooting\n+\t//  3: 2 + more verbose troubleshooting of Object (de)serialization. When \n     //     used from ava wrapping in GUI/Matlab this catches all exceptions \n     //     thrown by the low level libraries which is slower but helpful in \n     //     troubleshooting.\n-    static int      _debugLevel;\n+\tstatic int      _debugLevel;\n \n-    // The name of this object.\n-    std::string     _name;\n-    // A short description of the object.\n-    std::string     _description;\n+\t// The name of this object.\n+\tstd::string     _name;\n+\t// A short description of the object.\n+\tstd::string     _description;\n \n-    // List of authors who contributed to the implementation of concrete object.\n-    std::string     _authors;\n-    // List of references that should be cited when using this concrete object.\n-    std::string     _references;\n+\t// List of authors who contributed to the implementation of concrete object.\n+\tstd::string     _authors;\n+\t// List of references that should be cited when using this concrete object.\n+\tstd::string     _references;\n \n-    // Property table for serializable properties of this and derived classes.\n-    PropertyTable   _propertyTable;\n+\t// Property table for serializable properties of this and derived classes.\n+\tPropertyTable   _propertyTable;\n     // This flag is cleared automatically whenever a property is changed. It \n     // is initialized to false and is only set manually.\n     bool            _objectIsUpToDate;\n \n-    // The XML document, if any, associated with this object.\n+\t// The XML document, if any, associated with this object.\n     // This is mutable since it\'s cached on deserialization and is \n     // kept up to date to maintain "defaults" and document file path\n     //TODO: why does an Object need to know where it was last written? Seems flaky and should be revisited\n     mutable XMLDocument     *_document;\n-    // Flag indicating whether the object is serialized to this _document or \n+\t// Flag indicating whether the object is serialized to this _document or \n     // to another fresh document, also cached for subsequent printing/writing.\n     mutable bool            _inlined;\n \n //==============================================================================\n-};  // END of class Object\n+};\t// END of class Object\n \n \n \n@@ -887,18 +876,18 @@ hasProperty() const {\n         "only allowed when T is an Object-derived type, but T=" \n         + std::string(SimTK::NiceTypeName<T>::name()) + ". For lookup by "\n         "property name instead, use hasProperty(\\"prop_name\\").");\n-    return false;\n+\treturn false;\n }\n \n template <class T> const Property<T>& Object::\n getProperty(const PropertyIndex& index) const {\n-    return _propertyTable.getProperty<T>(index);\n+\treturn _propertyTable.getProperty<T>(index);\n }\n \n template <class T> Property<T>& Object::\n updProperty(const PropertyIndex& index) {\n     _objectIsUpToDate = false; // property may be changed\n-    return _propertyTable.updProperty<T>(index);\n+\treturn _propertyTable.updProperty<T>(index);\n }\n \n template <class T> PropertyIndex Object::\n@@ -916,7 +905,7 @@ addProperty(const std::string& name,\n \n     // Note that an unnamed, one-object property will use the object class name\n     // as a name for lookup purposes.\n-    return PropertyIndex(_propertyTable.adoptProperty(p));\n+\treturn PropertyIndex(_propertyTable.adoptProperty(p));\n }\n \n template <class T> PropertyIndex Object::\n@@ -935,7 +924,7 @@ addOptionalProperty(const std::string& name,\n     p->appendValue(value);\n     p->setValueIsDefault(true);\n \n-    return PropertyIndex(_propertyTable.adoptProperty(p));\n+\treturn PropertyIndex(_propertyTable.adoptProperty(p));\n }\n \n template <class T> PropertyIndex Object::\n@@ -952,7 +941,7 @@ addOptionalProperty(const std::string& name,\n     p->setComment(comment);\n     p->setValueIsDefault(true);\n \n-    return PropertyIndex(_propertyTable.adoptProperty(p));\n+\treturn PropertyIndex(_propertyTable.adoptProperty(p));\n }\n \n template <class T> PropertyIndex Object::\n@@ -978,7 +967,7 @@ addListProperty(const std::string& name,\n     p->setComment(comment);\n     p->setValueIsDefault(true);\n \n-    return PropertyIndex(_propertyTable.adoptProperty(p));\n+\treturn PropertyIndex(_propertyTable.adoptProperty(p));\n }\n \n template <class T, template<class> class Container> PropertyIndex Object::\n@@ -1006,7 +995,7 @@ addListProperty(const std::string&  name,\n         p->appendValue(valueList[i]);\n     p->setValueIsDefault(true);\n \n-    return PropertyIndex(_propertyTable.adoptProperty(p));\n+\treturn PropertyIndex(_propertyTable.adoptProperty(p));\n }\n \n \n@@ -1141,10 +1130,10 @@ private:\n   } \\\n   virtual void assign(Object &aObject) \\\n   { \\\n-      if (safeDownCast(&aObject)!=0) { \\\n-          *this = *((thisClass*)(&aObject)); \\\n+\t  if (safeDownCast(&aObject)!=0) { \\\n+\t\t  *this = *((thisClass*)(&aObject)); \\\n      } else { \\\n-      throw OpenSim::Exception(std::string(#thisClass)+ \\\n+\t  throw OpenSim::Exception(std::string(#thisClass)+ \\\n               "::copy() called with object (name = " + aObject.getName() \\\n               + ", type = " + aObject.getConcreteClassName()+").", \\\n               __FILE__,__LINE__); \\\n@@ -1200,13 +1189,13 @@ ObjectProperty<T>::readFromXMLElement\n     int                  versionNumber)\n {\n     clearValues();\n-    // LOOP THROUGH PROPERTY ELEMENT\'S CHILD ELEMENTS\n+\t// LOOP THROUGH PROPERTY ELEMENT\'S CHILD ELEMENTS\n     // Each element is expected to be an Object of some type given\n     // by the element\'s tag; that type must be derived from O or we\n     // can\'t store it in this property.\n-    int objectsFound = 0;\n-    SimTK::Xml::element_iterator iter = propertyElement.element_begin();\n-    for (; iter != propertyElement.element_end(); ++iter) {\n+\tint objectsFound = 0;\n+\tSimTK::Xml::element_iterator iter = propertyElement.element_begin();\n+\tfor (; iter != propertyElement.element_end(); ++iter) {\n         const SimTK::String& objTypeTag = iter->getElementTag();\n \n         const Object* registeredObj = \n@@ -1228,20 +1217,20 @@ ObjectProperty<T>::readFromXMLElement\n                         << "; ignoring.\\n";\n             continue;                        \n         }\n-        ++objectsFound;\n+\t\t++objectsFound;\n \n         if (objectsFound > this->getMaxListSize())\n             continue; // ignore this one\n \n-        // Create an Object of the element tag\'s type.\n-        Object* object = Object::newInstanceOfType(objTypeTag);\n+\t\t// Create an Object of the element tag\'s type.\n+\t\tObject* object = Object::newInstanceOfType(objTypeTag);\n         assert(object); // we just checked above\n-        object->readObjectFromXMLNodeOrFile(*iter, versionNumber);\n+\t\tobject->readObjectFromXMLNodeOrFile(*iter, versionNumber);\n \n         T* objectT = dynamic_cast<T*>(object);\n         assert(objectT); // should have worked by construction\n         adoptAndAppendValueVirtual(objectT); // don\'t copy\n-    }\n+\t}\n \n     if (objectsFound < this->getMinListSize()) {\n         std::cerr << "Got " << objectsFound \ndiff --git a/OpenSim/Common/RegisterTypes_osimCommon.cpp b/OpenSim/Common/RegisterTypes_osimCommon.cpp\nindex 1207e1d52..2f7458bb6 100644\n--- a/OpenSim/Common/RegisterTypes_osimCommon.cpp\n+++ b/OpenSim/Common/RegisterTypes_osimCommon.cpp\n@@ -24,12 +24,12 @@\n \n #include "Object.h"\n #include "Component.h"\n-#include "VisibleObject.h"\n #include "RegisterTypes_osimCommon.h"\n #include "FunctionSet.h"\n #include "GCVSplineSet.h"\n #include "ScaleSet.h"\n #include "GCVSpline.h"\n+#include "Geometry.h"\n \n #include "Scale.h"\n #include "SimmSpline.h"\n@@ -42,9 +42,6 @@\n #include "MultiplierFunction.h"\n #include "PolynomialFunction.h"\n \n-#include "DisplayGeometry.h"\n-#include "GeometrySet.h"\n-#include "VisibleObject.h"\n #include "ObjectGroup.h"\n \n #include <string>\n@@ -66,42 +63,37 @@ OSIMCOMMON_API void RegisterTypes_osimCommon()\n \n     Object::registerType(Connector<Component>());\n \n-    // Register commonly used Inputs for de/serialization\n-    Object::registerType(Input<double>());\n-    Object::registerType(Input<SimTK::Vec3>());\n-    Object::registerType(Input<SimTK::Vector>());\n-    Object::registerType(Input<SimTK::SpatialVec>());\n-\n-    //SimTK::Xml::setXmlCondenseWhiteSpace(false);\n-    Object::registerType( FunctionSet() );\n-    Object::registerType( GCVSplineSet() );\n-    Object::registerType( ScaleSet() );\n-\n-    Object::registerType( GCVSpline() );\n-\n-    Object::registerType( Scale() );\n-    Object::registerType( SimmSpline() );\n-    Object::registerType( Constant() );\n-    Object::registerType( Sine() );\n-    Object::registerType( StepFunction() );\n-    Object::registerType( LinearFunction() );\n-    Object::registerType( PiecewiseLinearFunction() );\n-    Object::registerType( PiecewiseConstantFunction() );\n-    Object::registerType( MultiplierFunction() );\n-    Object::registerType(PolynomialFunction());\n-\n-\n-    Object::registerType( DisplayGeometry() );\n-    Object::registerType( GeometrySet() );\n-    Object::registerType( VisibleObject() );\n-    Object::registerType( ObjectGroup() );\n+\t// Register commonly used Inputs for de/serialization\n+\tObject::registerType(Input<double>());\n+\tObject::registerType(Input<SimTK::Vec3>());\n+\tObject::registerType(Input<SimTK::Vector>());\n+\tObject::registerType(Input<SimTK::SpatialVec>());\n+\n+\t//SimTK::Xml::setXmlCondenseWhiteSpace(false);\n+\tObject::registerType( FunctionSet() );\n+\tObject::registerType( GCVSplineSet() );\n+\tObject::registerType( ScaleSet() );\n+\n+\tObject::registerType( GCVSpline() );\n+\n+\tObject::registerType( Scale() );\n+\tObject::registerType( SimmSpline() );\n+\tObject::registerType( Constant() );\n+\tObject::registerType( Sine() );\n+\tObject::registerType( StepFunction() );\n+\tObject::registerType( LinearFunction() );\n+\tObject::registerType( PiecewiseLinearFunction() );\n+\tObject::registerType( PiecewiseConstantFunction() );\n+\tObject::registerType( MultiplierFunction() );\n+\tObject::registerType(PolynomialFunction());\n+\tObject::registerType( ObjectGroup() );\n \n     // TODO: temporarily map old NaturalCubicSpline (which wasn\'t a \n     // natural cubic spline) to renamed SimmSpline class. Later we\n     // will replace this with an actual natural cubic spline.\n-    Object::renameType("NaturalCubicSpline", "SimmSpline");\n-    // To support older type name of "natCubicSpline"\n-    Object::renameType("natCubicSpline", "SimmSpline");\n+\tObject::renameType("NaturalCubicSpline", "SimmSpline");\n+\t// To support older type name of "natCubicSpline"\n+\tObject::renameType("natCubicSpline", "SimmSpline");\n \n   } catch (const std::exception& e) {\n     std::cerr \ndiff --git a/OpenSim/Common/VisibleObject.cpp b/OpenSim/Common/VisibleObject.cpp\ndeleted file mode 100644\nindex 1f3167195..000000000\n--- a/OpenSim/Common/VisibleObject.cpp\n+++ /dev/null\n@@ -1,361 +0,0 @@\n-/* -------------------------------------------------------------------------- *\n- *                        OpenSim:  VisibleObject.cpp                         *\n- * -------------------------------------------------------------------------- *\n- * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *\n- * See http://opensim.stanford.edu and the NOTICE file for more information.  *\n- * OpenSim is developed at Stanford University and supported by the US        *\n- * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *\n- * through the Warrior Web program.                                           *\n- *                                                                            *\n- * Copyright (c) 2005-2012 Stanford University and the Authors                *\n- * Author(s): Ayman Habib                                                     *\n- *                                                                            *\n- * Licensed under the Apache License, Version 2.0 (the "License"); you may    *\n- * not use this file except in compliance with the License. You may obtain a  *\n- * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *\n- *                                                                            *\n- * Unless required by applicable law or agreed to in writing, software        *\n- * distributed under the License is distributed on an "AS IS" BASIS,          *\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *\n- * See the License for the specific language governing permissions and        *\n- * limitations under the License.                                             *\n- * -------------------------------------------------------------------------- */\n-\n-/*  \n- * Author:  \n- */\n-\n-\n-//============================================================================\n-// INCLUDES\n-//============================================================================\n-#include <OpenSim/Common/XMLDocument.h>\n-#include "VisibleObject.h"\n-#include "Exception.h"\n-#include "PropertyInt.h"\n-#include "PropertyStr.h"\n-#include "PropertyObj.h"\n-#include "PropertyDblArray.h"\n-#include "PropertyTransform.h"\n-#include "Geometry.h"\n-#include "GeometrySet.h"\n-\n-\n-using namespace OpenSim;\n-using namespace std;\n-using SimTK::Vec3;\n-using OpenSim::GeometrySet;\n-\n-//============================================================================\n-// CONSTANTS\n-//============================================================================\n-\n-\n-//=============================================================================\n-// CONSTRUCTOR(S)\n-//=============================================================================\n-//_____________________________________________________________________________\n-/**\n- * Destructor.\n- */\n-VisibleObject::~VisibleObject()\n-{\n-    freeGeometry();\n-    _owner = NULL;\n-    _dependents.setSize(0);\n-};\n-\n-//_____________________________________________________________________________\n-/**\n- * Default constructor.\n- */\n-VisibleObject::VisibleObject():\n-Object(),\n-_propGeometrySet(PropertyObj("", GeometrySet())),\n-_geometrySet((GeometrySet&)_propGeometrySet.getValueObj()),\n-_scaleFactors(_propScaleFactors.getValueDblVec()),\n-_transformProp(PropertyTransform("transform", SimTK::Transform())),\n-_transform(_transformProp.getValueTransform()),\n-_showAxes(_propShowAxes.getValueBool()),\n-_displayPreference((DisplayGeometry::DisplayPreference&)_propDisplayPreference.getValueInt()),\n-_allGeometry(0),\n-_dependents(0)\n-{\n-    // NULL STATES\n-    setNull();\n-\n-    // MEMBER VARIABLES\n-    setName("");\n-}\n-\n-//_____________________________________________________________________________\n-/**\n- * Construct an object from file.\n- *\n- * The object is constructed from the root element of the XML document.\n- * The type of object is the tag name of the XML root element.\n- *\n- * @param aFileName File name of the document.\n- */\n-VisibleObject::VisibleObject(const string &aFileName):\n-Object(aFileName, false),\n-_propGeometrySet(PropertyObj("", GeometrySet())),\n-_geometrySet((GeometrySet&)_propGeometrySet.getValueObj()),\n-_scaleFactors(_propScaleFactors.getValueDblVec()),\n-_transformProp(PropertyTransform("transform", SimTK::Transform())),\n-_transform(_transformProp.getValueTransform()),\n-_showAxes(_propShowAxes.getValueBool()),\n-_displayPreference((DisplayGeometry::DisplayPreference&)_propDisplayPreference.getValueInt()),\n-_allGeometry(0),\n-_dependents(0)\n-{\n-    // NULL STATES\n-    setNull();\n-\n-    SimTK::Xml::Element e = updDocument()->getRootDataElement(); \n-    updateFromXMLNode(e);\n-}\n-//_____________________________________________________________________________\n-/**\n- * Copy constructor.\n- *\n- * Copy constructors for all VisibleObject\'s only copy the non-XML variable\n- * members of the object; that is, the object\'s DOMnode and XMLDocument\n- * are not copied but set to NULL.  The reason for this is that for the\n- * object and all its derived classes to establish the correct connection\n- * to the XML document nodes, the the object would need to reconstruct based\n- * on the XML document not the values of the object\'s member variables.\n- *\n- * There are three proper ways to generate an XML document for an VisibleObject:\n- *\n- * 1) Construction based on XML file (@see VisibleObject(const char *aFileName)).\n- * In this case, the XML document is created by parsing the XML file.\n- *\n- * 2) Construction by VisibleObject(const XMLDocument *aDocument).\n- * This constructor explictly requests construction based on an\n- * XML document.  In this way the proper connection between an object\'s node\n- * and the corresponding node within the XML document is established.\n- * This constructor is a copy constructor of sorts because all essential\n- * VisibleObject member variables should be held within the XML document.\n- * The advantage of this style of construction is that nodes\n- * within the XML document, such as comments that may not have any\n- * associated VisibleObject member variable, are preserved.\n- *\n- * 3) A call to generateXMLDocument().\n- * This method generates an XML document for the VisibleObject from scratch.\n- * Only the essential document nodes are created (that is, nodes that\n- * correspond directly to member variables.).\n- *\n- * @param aObject Object to be copied.\n- * @see VisibleObject(const XMLDocument *aDocument)\n- * @see VisibleObject(const char *aFileName)\n- * @see generateXMLDocument()\n- */\n-VisibleObject::VisibleObject(const VisibleObject &aObject):\n-Object(aObject),\n-_propGeometrySet(PropertyObj("", GeometrySet())),\n-_geometrySet((GeometrySet&)_propGeometrySet.getValueObj()),\n-_scaleFactors(_propScaleFactors.getValueDblVec()),\n-_transformProp(PropertyTransform("transform", SimTK::Transform())),\n-_transform(_transformProp.getValueTransform()),\n-_showAxes(_propShowAxes.getValueBool()),\n-_displayPreference((DisplayGeometry::DisplayPreference&)_propDisplayPreference.getValueInt()),\n-_allGeometry(0),\n-_dependents(0)\n-{\n-    // NULL MEMBER VARIABLES\n-    setNull();\n-\n-    // COPY TYPE AND NAME\n-    *this = aObject;\n-}\n-\n-\n-//=============================================================================\n-// CONSTRUCTION METHODS\n-//=============================================================================\n-//_____________________________________________________________________________\n-/**\n- * Set all member variables to their null or default values.\n- */\n-void VisibleObject::setNull()\n-{\n-    setupProperties();\n-\n-    _scaleFactors = 1.0;\n-    _transform = SimTK::Transform();\n-    _owner = 0;\n-    _dependents.setMemoryOwner(false);\n-    _showAxes=false;\n-    _displayPreference=DisplayGeometry::GouraudShaded;\n-\n-\n-}\n-\n-//_____________________________________________________________________________\n-/**\n- * Connect properties to local pointers.\n- */\n-void VisibleObject::setupProperties()\n-{\n-\n-    _propGeometrySet.setName("GeometrySet");\n-    _propGeometrySet.setComment("Set of geometry files and associated attributes, allow .vtp, .stl, .obj");\n-\n-    _propertySet.append(&_propGeometrySet);\n-\n-    _propScaleFactors.setName("scale_factors");\n-    _propScaleFactors.setComment("Three scale factors for display purposes: scaleX scaleY scaleZ");\n-    _propertySet.append(&_propScaleFactors);\n-\n-    _transformProp.setName("transform");\n-    _transformProp.setComment("transform relative to owner specified as 3 rotations (rad) followed by 3 translations rX rY rZ tx ty tz");\n-    _propertySet.append(&_transformProp);\n-\n-    _propShowAxes.setName("show_axes");\n-    _propShowAxes.setComment("Whether to show a coordinate frame");\n-    _propertySet.append(&_propShowAxes);\n-\n-    _propDisplayPreference.setName("display_preference");\n-    _propDisplayPreference.setComment("Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for individual geometries");\n-    _propertySet.append(&_propDisplayPreference);\n-\n-}\n-\n-//=============================================================================\n-// OPERATORS\n-//=============================================================================\n-//-----------------------------------------------------------------------------\n-// ASSIGNMENT\n-//-----------------------------------------------------------------------------\n-//_____________________________________________________________________________\n-/**\n- * Assign this object to the values of another.\n- *\n- * @return Reference to this object.\n- */\n-VisibleObject& VisibleObject::operator=(const VisibleObject &aObject)\n-{\n-    // BASE CLASS\n-    Object::operator=(aObject);\n-\n-    _geometrySet = aObject._geometrySet;\n-    _scaleFactors = aObject._scaleFactors;\n-    _transform = aObject._transform;\n-    _showAxes = aObject._showAxes;\n-    _displayPreference = aObject._displayPreference;\n-    return(*this);\n-}\n-\n-//-----------------------------------------------------------------------------\n-// EQUALITY\n-//-----------------------------------------------------------------------------\n-//_____________________________________________________________________________\n-/**\n- * Determine if two objects are equal.\n- *\n- * @return True if the two objects are equal, false otherwise.\n- */\n-bool VisibleObject::operator==(const VisibleObject &aObject) const\n-{\n-    return(Object::operator==(aObject));\n-}\n-\n-\n-//=============================================================================\n-// GET AND SET\n-//=============================================================================\n-//_____________________________________________________________________________\n-/**\n- * Set Scale factors for geometry.\n- *\n- */\n-void VisibleObject::setScaleFactors(const SimTK::Vec3& aScaleFactors)\n-{\n-    _propScaleFactors.setValueIsDefault(false);\n-    _scaleFactors=aScaleFactors;\n-}\n-//_____________________________________________________________________________\n-/**\n- * Get Scale factors for geometry.\n- *\n- */\n-void VisibleObject::getScaleFactors(SimTK::Vec3& aScaleFactors) const\n-{\n-    aScaleFactors = _scaleFactors;\n-}\n-\n-void VisibleObject::getRotationsAndTranslationsAsArray6(double aArray[]) const\n-{\n-    _transformProp.getRotationsAndTranslationsAsArray6(aArray);\n-}\n-\n-\n-void VisibleObject::setGeometryFileName(int i, const std::string &aGeometryFileName)\n-{\n-    _propGeometrySet.setValueIsDefault(false);\n-    _geometrySet.adoptAndAppend(new DisplayGeometry(aGeometryFileName));\n-}\n-\n-const int VisibleObject::getNumGeometryFiles() const\n-{\n-    return _geometrySet.getSize();\n-}\n-void VisibleObject::setNumGeometryFiles(int n)\n-{\n-    _geometrySet.setSize(n);\n-}\n-const std::string& VisibleObject::getGeometryFileName(int idx) const \n-{\n-    if (idx > _geometrySet.getSize()-1)\n-        throw ( Exception("getGeometryFileName: no geometry corresponding to index") );\n-    return _geometrySet[idx].getGeometryFile();\n-}\n-\n-// DisplayPreference\n-DisplayGeometry::DisplayPreference VisibleObject::getDisplayPreference() const\n-{\n-    return _displayPreference;\n-}\n-void VisibleObject::setDisplayPreference(const DisplayGeometry::DisplayPreference& aPreference)\n-{\n-    _displayPreference = aPreference;\n-    // Push preference down to pieces\n-    for(int i=0; i<_geometrySet.getSize(); i++)\n-        _geometrySet[i].setDisplayPreference(aPreference);\n-}\n-// Handle conversion from older format\n-void VisibleObject::updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber)\n-{ \n-    SimTK::Array_<SimTK::String> oldGeometryFiles;\n-    if ( versionNumber < XMLDocument::getLatestVersion()){\n-        if (versionNumber<20101){\n-            SimTK::Xml::element_iterator visPropIter = aNode.element_begin("VisibleProperties");\n-            // Get geometry files and Preferences if any and set them into \n-            if (visPropIter!=aNode.element_end()){\n-                // Move display_prference, and show_axes nodes up to VisibleObject\n-                SimTK::Xml::element_iterator  prefIter = visPropIter->element_begin("display_preference");\n-                if (prefIter!= visPropIter->element_end()){\n-                    SimTK::Xml::Node moveNode = visPropIter->removeNode(prefIter);\n-                    aNode.insertNodeAfter(aNode.element_end(), moveNode);\n-                }\n-                SimTK::Xml::element_iterator  showAxesIter = visPropIter->element_begin("show_axes");\n-                if (showAxesIter!=aNode.element_end()){\n-                    SimTK::Xml::Node moveNode = visPropIter->removeNode(showAxesIter);\n-                    aNode.insertNodeAfter(aNode.element_end(), moveNode);\n-                }\n-            }\n-            SimTK::Xml::element_iterator geometryIter = aNode.element_begin("geometry_files");\n-            string propValue="";\n-            bool hasPieces=false;\n-            if (geometryIter!= aNode.element_end()){\n-                geometryIter->getValueAs(oldGeometryFiles);\n-            }\n-        }\n-    }\n-    Object::updateFromXMLNode(aNode, versionNumber);\n-    if (oldGeometryFiles.size()>0){\n-        for(unsigned i=0; i< oldGeometryFiles.size(); i++) \n-            setGeometryFileName(i, oldGeometryFiles[i]);\n-    }\n-}\ndiff --git a/OpenSim/Common/VisibleObject.h b/OpenSim/Common/VisibleObject.h\ndeleted file mode 100644\nindex 5119d590d..000000000\n--- a/OpenSim/Common/VisibleObject.h\n+++ /dev/null\n@@ -1,256 +0,0 @@\n-#ifndef _VisibleObject_h_\n-#define _VisibleObject_h_\n-/* -------------------------------------------------------------------------- *\n- *                         OpenSim:  VisibleObject.h                          *\n- * -------------------------------------------------------------------------- *\n- * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *\n- * See http://opensim.stanford.edu and the NOTICE file for more information.  *\n- * OpenSim is developed at Stanford University and supported by the US        *\n- * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *\n- * through the Warrior Web program.                                           *\n- *                                                                            *\n- * Copyright (c) 2005-2012 Stanford University and the Authors                *\n- * Author(s): Ayman Habib                                                     *\n- *                                                                            *\n- * Licensed under the Apache License, Version 2.0 (the "License"); you may    *\n- * not use this file except in compliance with the License. You may obtain a  *\n- * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *\n- *                                                                            *\n- * Unless required by applicable law or agreed to in writing, software        *\n- * distributed under the License is distributed on an "AS IS" BASIS,          *\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *\n- * See the License for the specific language governing permissions and        *\n- * limitations under the License.                                             *\n- * -------------------------------------------------------------------------- */\n-\n-/*  \n- * Author:  \n- */\n-\n-\n-// INCLUDES\n-#include "osimCommonDLL.h"\n-#include "Object.h"\n-#include "PropertyObj.h"\n-#include "PropertyDblArray.h"\n-#include "PropertyDblVec.h"\n-#include "PropertyTransform.h"\n-#include "PropertyBool.h"\n-#include "Geometry.h"\n-#include "DisplayGeometry.h"\n-#include "SimTKcommon.h"\n-#include "GeometrySet.h"\n-\n-#ifndef SWIG\n-using SimTK::Transform;\n-#endif\n-\n-namespace OpenSim { \n-\n-class Geometry;\n-class GeometrySet;\n-// CONSTANTS\n-\n-//=============================================================================\n-//=============================================================================\n-/**\n- * Class VisibleObject is intended to be used as the base class for all\n- * Visible objects that subclass Object.  It provides a common object from which\n- * to derive and also some basic functionality, such as maintaining geometry\n- *\n- * @version 1.0\n- * @author Ayman Habib\n- */\n-\n-class OSIMCOMMON_API VisibleObject: public Object {\n-OpenSim_DECLARE_CONCRETE_OBJECT(VisibleObject, Object);\n-\n-//=============================================================================\n-// DATA\n-//=============================================================================\n-private:\n-    // PROPERTIES\n-    /** Name of geometry(s) */\n-    PropertyObj         _propGeometrySet;\n-    OpenSim::GeometrySet&   _geometrySet;   \n-\n-    /** Scale factors for geometry. */\n-    PropertyDblVec3     _propScaleFactors;\n-    SimTK::Vec3&        _scaleFactors;\n-\n-    /** Transform of Geometries relative to owner frame */\n-    PropertyTransform   _transformProp;\n-    Transform&          _transform; // transform relative to _owner\'s frame. \n-\n-    /** Whether to show frame at the origin of the geometry owner */\n-    PropertyBool        _propShowAxes;\n-    bool&               _showAxes;\n-\n-    /** DisplayPreference 0 up to 4 if geometry contains pieces their preferences take precedence*/\n-    PropertyInt _propDisplayPreference;\n-    DisplayGeometry::DisplayPreference& _displayPreference;\n-\n-protected:\n-    Object*             _owner; // Actual object that owns this VisibleObject\n-\n-    Array<Geometry*>   _allGeometry;\n-    // In general these can use the Observable mechanism but that would be slow \n-    // for display purposes.\n-    ArrayPtrs<VisibleObject>    _dependents;\n-//=============================================================================\n-// METHODS\n-//=============================================================================\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n-public:\n-    VisibleObject();\n-    VisibleObject(const std::string &aFileName);\n-    VisibleObject(const VisibleObject &aVisibleObject);\n-    virtual ~VisibleObject();\n-\n-private:\n-    void setNull();\n-\n-    //--------------------------------------------------------------------------\n-    // OPERATORS\n-    //--------------------------------------------------------------------------\n-public:\n-#ifndef SWIG\n-    VisibleObject& operator=(const VisibleObject &aObject);\n-    virtual bool operator==(const VisibleObject &aObject) const;\n-#endif\n-    //--------------------------------------------------------------------------\n-    // GET AND SET\n-    //--------------------------------------------------------------------------\n-public:\n-    // OWNER OBJECT\n-    void setOwner(Object *aObject)\n-    {\n-        _owner = aObject;\n-    }\n-\n-    Object* getOwner()\n-    {\n-        return _owner;\n-    }\n-    // GEOMETRY FILES\n-    void setNumGeometryFiles(int n);\n-    void setGeometryFileName(int i, const std::string &aGeometryFileName);\n-    const int getNumGeometryFiles() const;\n-    const std::string& getGeometryFileName(int i) const;\n-\n-    const GeometrySet& getGeometrySet() const { \n-        return (_geometrySet); \n-    };\n-\n-    GeometrySet& updGeometrySet() {\n-        return (_geometrySet);\n-    };\n-    // TRANSFORM\n-    const SimTK::Transform& getTransform() const {\n-        return _transform;\n-    }\n-    SimTK::Transform& updTransform() {\n-        return _transform;\n-    }\n-    void getRotationsAndTranslationsAsArray6(double aArray[]) const;\n-    void getTransformAsDouble16(double flatList[]) {\n-        double* matStart = &_transform.toMat44()[0][0];\n-        for (int i=0; i<16; i++) flatList[i]=matStart[i];\n-    }\n-\n-    void setTransform(const SimTK::Transform& aTransform) {\n-        _transform = aTransform;\n-    }\n-    void translate(const SimTK::Vec3& t) {\n-        _transform.updP() = _transform.p()+t;\n-    }\n-\n-    // Scale\n-    void setScaleFactors(const SimTK::Vec3& aScaleFactors);\n-    void getScaleFactors(SimTK::Vec3& aScaleFactors) const;\n-    // A variation that uses raw arrays for use from GUI only.\n-    void setScaleFactors(const double aScaleFactors[]){\n-        setScaleFactors(SimTK::Vec3::getAs(aScaleFactors));\n-    }\n-    void getScaleFactors(double aScaleFactors[]) const {\n-        getScaleFactors(SimTK::Vec3::updAs(aScaleFactors));\n-    } \n-\n-    // Axes\n-    bool getShowAxes() const { return _showAxes; };\n-    void setShowAxes(const bool showAxes) { _showAxes = showAxes; };\n-\n-    // DisplayPreference\n-    DisplayGeometry::DisplayPreference getDisplayPreference() const;\n-    void setDisplayPreference(const DisplayGeometry::DisplayPreference& aPreference);\n-\n-    // DEPENDENTS\n-    void addDependent(VisibleObject *aChild){ \n-        if (!hasDependent(aChild))\n-            _dependents.append(aChild);\n-    };\n-    bool hasDependent(VisibleObject *aChild){ // Check if dependency already added\n-        for(int i=0; i < _dependents.getSize(); i++){\n-            if (_dependents.get(i)==aChild)\n-                return true; \n-        }\n-        return false;\n-    };\n-    void removeDependent(VisibleObject *aChild){ _dependents.remove(aChild); };\n-    int countDependents(){ return _dependents.getSize(); };\n-    VisibleObject *getDependent(int i) { \n-        return _dependents.get(i); \n-    };\n-    // GEOMETRY ITEMS\n-    void addGeometry(Geometry* aGeometry)\n-    {\n-        _allGeometry.append(aGeometry);\n-    };\n-    void removeGeometry(Geometry* aGeometry)\n-    {\n-        _allGeometry.remove(_allGeometry.findIndex(aGeometry));\n-    };\n-    // Release resources allocated by the display support code.\n-    void freeGeometry()\n-    {\n-        for (int i=_allGeometry.getSize()-1; i >= 0; i--)\n-            delete _allGeometry.get(i);\n-        _allGeometry.setSize(0);\n-    }\n-    Geometry* getGeometry(int i)\n-    {\n-        return _allGeometry.get(i);\n-    }\n-    int countGeometry() const\n-    {\n-        return _allGeometry.getSize();\n-    };\n-    const Geometry* getDefaultGeometry()\n-    {\n-        return AnalyticSphere::createSphere(0.1);\n-    }\n-\n-    //--------------------------------------------------------------------------\n-    // XML\n-    //--------------------------------------------------------------------------\n-    void setupProperties();\n-\n-    virtual void updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber=-1);\n-\n-    // updateGeometry is the method used to update geometry that can change (e.g. muscles\n-    // changing geometry during motion).\n-    // Clients/subclasses should not override this method unless their geometry is changing.\n-    // This call forces the "recomputation" of geometry aside from display implications.\n-protected:\n-    virtual void updateGeometry() {};\n-\n-//=============================================================================\n-};  // END of class VisibleObject\n-\n-}; //namespace\n-//=============================================================================\n-//=============================================================================\n-\n-#endif //__VisibleObject_h__\ndiff --git a/OpenSim/Common/osimCommon.h b/OpenSim/Common/osimCommon.h\nindex b1c924a61..ecf17c196 100644\n--- a/OpenSim/Common/osimCommon.h\n+++ b/OpenSim/Common/osimCommon.h\n@@ -24,13 +24,13 @@\n  * -------------------------------------------------------------------------- */\n \n #include "Object.h"\n-#include "VisibleObject.h"\n #include "RegisterTypes_osimCommon.h"\n #include "FunctionSet.h"\n #include "GCVSplineSet.h"\n #include "ScaleSet.h"\n #include "GCVSpline.h"\n #include "IO.h"\n+#include "Geometry.h"\n \n #include "Scale.h"\n #include "SimmSpline.h"\n@@ -44,7 +44,6 @@\n #include "MultiplierFunction.h"\n #include "PolynomialFunction.h"\n \n-#include "VisibleObject.h"\n #include "ObjectGroup.h"\n #include "StorageInterface.h"\n #include "LoadOpenSimLibrary.h"\ndiff --git a/OpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp b/OpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\nindex 0f1013408..aa4f8fb68 100644\n--- a/OpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\n+++ b/OpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\n@@ -45,196 +45,196 @@ using namespace SimTK;\n int main()\n {\n \n-    try {\n-        // Create a new OpenSim model\n-        Model osimModel;\n-        osimModel.setName("osimModel");\n-        osimModel.setAuthors("Matt DeMers");\n-\n-        double Pi = SimTK::Pi;\n-            \n-        // Get the ground body\n+\ttry {\n+\t\t// Create a new OpenSim model\n+\t\tModel osimModel;\n+\t\tosimModel.setName("osimModel");\n+\t\tosimModel.setAuthors("Matt DeMers");\n+\n+\t\tdouble Pi = SimTK::Pi;\n+\t\t\t\n+\t\t// Get the ground body\n         Ground& ground = osimModel.updGround();\n-        ground.addDisplayGeometry("checkered_floor.vtp");\n-\n-        // create linkage body\n-        double linkageMass = 0.001, linkageLength = 0.5, linkageDiameter = 0.06;\n-        \n-        Vec3 linkageDimensions(linkageDiameter, linkageLength, linkageDiameter);\n-        Vec3 linkageMassCenter(0,linkageLength/2,0);\n-        Inertia linkageInertia = Inertia::cylinderAlongY(linkageDiameter/2.0, linkageLength/2.0);\n-\n-        OpenSim::Body* linkage1 = new OpenSim::Body("linkage1", linkageMass, linkageMassCenter, linkageMass*linkageInertia);\n-\n-        // Graphical representation\n-        linkage1->addDisplayGeometry("cylinder.vtp");\n-        //This cylinder.vtp geometry is 1 meter tall, 1 meter diameter.  Scale and shift it to look pretty\n-        GeometrySet& geometry = linkage1->updDisplayer()->updGeometrySet();\n-        DisplayGeometry& thinCylinder = geometry[0];\n-        thinCylinder.setScaleFactors(linkageDimensions);\n-        thinCylinder.setTransform(Transform(Vec3(0.0,linkageLength/2.0,0.0)));\n-        linkage1->addDisplayGeometry("sphere.vtp");\n-        //This sphere.vtp is 1 meter in diameter.  Scale it.\n-        geometry[1].setScaleFactors(Vec3(0.1));\n-        \n-        // Creat a second linkage body\n-        OpenSim::Body* linkage2 = new OpenSim::Body(*linkage1);\n-        linkage2->setName("linkage2");\n-\n-        // Creat a block to be the pelvis\n-        double blockMass = 20.0, blockSideLength = 0.2;\n-        Vec3 blockMassCenter(0);\n-        Inertia blockInertia = blockMass*Inertia::brick(blockSideLength, blockSideLength, blockSideLength);\n-        OpenSim::Body *block = new OpenSim::Body("block", blockMass, blockMassCenter, blockInertia);\n-        block->addDisplayGeometry("block.vtp");\n-        //This block.vtp is 0.1x0.1x0.1 meters.  scale its appearance\n-        block->updDisplayer()->updGeometrySet()[0].setScaleFactors(Vec3(2.0));\n-\n-        // Create 1 degree-of-freedom pin joints between the bodies to creat a kinematic chain from ground through the block\n-        \n-        Vec3 orientationInGround(0), locationInGround(0), locationInParent(0.0, linkageLength, 0.0), orientationInChild(0), locationInChild(0);\n-\n-        PinJoint *ankle = new PinJoint("ankle", ground, locationInGround, orientationInGround, *linkage1, \n-            locationInChild, orientationInChild);\n-\n-        PinJoint *knee = new PinJoint("knee", *linkage1, locationInParent, orientationInChild, *linkage2,\n-            locationInChild, orientationInChild);\n-\n-        PinJoint *hip = new PinJoint("hip", *linkage2, locationInParent, orientationInChild, *block,\n-            locationInChild, orientationInChild);\n-        \n-        double range[2] = {-SimTK::Pi*2, SimTK::Pi*2};\n-        CoordinateSet& ankleCoordinateSet = ankle->upd_CoordinateSet();\n-        ankleCoordinateSet[0].setName("q1");\n-        ankleCoordinateSet[0].setRange(range);\n-\n-        CoordinateSet& kneeCoordinateSet = knee->upd_CoordinateSet();\n-        kneeCoordinateSet[0].setName("q2");\n-        kneeCoordinateSet[0].setRange(range);\n-\n-        CoordinateSet& hipCoordinateSet = hip->upd_CoordinateSet();\n-        hipCoordinateSet[0].setName("q3");\n-        hipCoordinateSet[0].setRange(range);\n-\n-        // Add the bodies to the model\n-        osimModel.addBody(linkage1);\n-        osimModel.addBody(linkage2);\n-        osimModel.addBody(block);\n-\n-        // Add the joints to the model\n-        osimModel.addJoint(ankle);\n-        osimModel.addJoint(knee);\n-        osimModel.addJoint(hip);\n-        // Define contraints on the model\n-        //  Add a point on line constraint to limit the block to vertical motion\n-\n-        Vec3 lineDirection(0,1,0), pointOnLine(0,0,0), pointOnBlock(0);\n-        PointOnLineConstraint *lineConstraint = new PointOnLineConstraint(ground, lineDirection, pointOnLine, *block, pointOnBlock);\n-        osimModel.addConstraint(lineConstraint);\n-\n-        // Add PistonActuator between the first linkage and the block\n-        Vec3 pointOnBodies(0);\n-        PistonActuator *piston = new PistonActuator();\n-        piston->setName("piston");\n-        piston->setBodyA(linkage1);\n-        piston->setBodyB(block);\n-        piston->setPointA(pointOnBodies);\n-        piston->setPointB(pointOnBodies);\n-        piston->setOptimalForce(200.0);\n-        piston->setPointsAreGlobal(false);\n-\n-        osimModel.addForce(piston);\n-        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n-        // Added ControllableSpring between the first linkage and the second block\n-        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n-        ControllableSpring *spring = new ControllableSpring;\n-        spring->setName("spring");\n-        spring->setBodyA(block);\n-        spring->setBodyB(linkage1);\n-        spring->setPointA(pointOnBodies);\n-        spring->setPointB(pointOnBodies);\n-        spring->setOptimalForce(2000.0);\n-        spring->setPointsAreGlobal(false);\n-        spring->setRestLength(0.8);\n-\n-        osimModel.addForce(spring);\n-\n-        // define the simulation times\n-        double t0(0.0), tf(15);\n-\n-        // create a controller to control the piston and spring actuators\n-        // the prescribed controller sets the controls as functions of time\n-        PrescribedController *legController = new PrescribedController();\n-        // give the legController control over all (two) model actuators\n-        legController->setActuators(osimModel.updActuators());\n-\n-        // specify some control nodes for spring stiffness control\n-        double t[] = {0.0, 4.0, 7.0,  10.0, 15.0};\n+\t\tground.addDisplayGeometry("checkered_floor.vtp");\n+\n+\t\t// create linkage body\n+\t\tdouble linkageMass = 0.001, linkageLength = 0.5, linkageDiameter = 0.06;\n+\t\t\n+\t\tVec3 linkageDimensions(linkageDiameter, linkageLength, linkageDiameter);\n+\t\tVec3 linkageMassCenter(0,linkageLength/2,0);\n+\t\tInertia linkageInertia = Inertia::cylinderAlongY(linkageDiameter/2.0, linkageLength/2.0);\n+\n+\t\tOpenSim::Body* linkage1 = new OpenSim::Body("linkage1", linkageMass, linkageMassCenter, linkageMass*linkageInertia);\n+        /*\n+\t\t// Graphical representation\n+\t\tlinkage1->addDisplayGeometry("cylinder.vtp");\n+\t\t//This cylinder.vtp geometry is 1 meter tall, 1 meter diameter.  Scale and shift it to look pretty\n+\t\tGeometrySet& geometry = linkage1->updDisplayer()->updGeometrySet();\n+\t\tDisplayGeometry& thinCylinder = geometry[0];\n+\t\tthinCylinder.setScaleFactors(linkageDimensions);\n+\t\tthinCylinder.setTransform(Transform(Vec3(0.0,linkageLength/2.0,0.0)));\n+\t\tlinkage1->addDisplayGeometry("sphere.vtp");\n+\t\t//This sphere.vtp is 1 meter in diameter.  Scale it.\n+\t\tgeometry[1].setScaleFactors(Vec3(0.1));\n+\t\t*/\n+\t\t// Creat a second linkage body\n+\t\tOpenSim::Body* linkage2 = new OpenSim::Body(*linkage1);\n+\t\tlinkage2->setName("linkage2");\n+\n+\t\t// Creat a block to be the pelvis\n+\t\tdouble blockMass = 20.0, blockSideLength = 0.2;\n+\t\tVec3 blockMassCenter(0);\n+\t\tInertia blockInertia = blockMass*Inertia::brick(blockSideLength, blockSideLength, blockSideLength);\n+\t\tOpenSim::Body *block = new OpenSim::Body("block", blockMass, blockMassCenter, blockInertia);\n+\t\tblock->addDisplayGeometry("block.vtp");\n+\t\t//This block.vtp is 0.1x0.1x0.1 meters.  scale its appearance\n+\t\t//block->updDisplayer()->updGeometrySet()[0].setScaleFactors(Vec3(2.0));\n+\n+\t\t// Create 1 degree-of-freedom pin joints between the bodies to creat a kinematic chain from ground through the block\n+\t\t\n+\t\tVec3 orientationInGround(0), locationInGround(0), locationInParent(0.0, linkageLength, 0.0), orientationInChild(0), locationInChild(0);\n+\n+\t\tPinJoint *ankle = new PinJoint("ankle", ground, locationInGround, orientationInGround, *linkage1, \n+\t\t\tlocationInChild, orientationInChild);\n+\n+\t\tPinJoint *knee = new PinJoint("knee", *linkage1, locationInParent, orientationInChild, *linkage2,\n+\t\t\tlocationInChild, orientationInChild);\n+\n+\t\tPinJoint *hip = new PinJoint("hip", *linkage2, locationInParent, orientationInChild, *block,\n+\t\t\tlocationInChild, orientationInChild);\n+\t\t\n+\t\tdouble range[2] = {-SimTK::Pi*2, SimTK::Pi*2};\n+\t\tCoordinateSet& ankleCoordinateSet = ankle->upd_CoordinateSet();\n+\t\tankleCoordinateSet[0].setName("q1");\n+\t\tankleCoordinateSet[0].setRange(range);\n+\n+\t\tCoordinateSet& kneeCoordinateSet = knee->upd_CoordinateSet();\n+\t\tkneeCoordinateSet[0].setName("q2");\n+\t\tkneeCoordinateSet[0].setRange(range);\n+\n+\t\tCoordinateSet& hipCoordinateSet = hip->upd_CoordinateSet();\n+\t\thipCoordinateSet[0].setName("q3");\n+\t\thipCoordinateSet[0].setRange(range);\n+\n+\t\t// Add the bodies to the model\n+\t\tosimModel.addBody(linkage1);\n+\t\tosimModel.addBody(linkage2);\n+\t\tosimModel.addBody(block);\n+\n+\t\t// Add the joints to the model\n+\t\tosimModel.addJoint(ankle);\n+\t\tosimModel.addJoint(knee);\n+\t\tosimModel.addJoint(hip);\n+\t\t// Define contraints on the model\n+\t\t//  Add a point on line constraint to limit the block to vertical motion\n+\n+\t\tVec3 lineDirection(0,1,0), pointOnLine(0,0,0), pointOnBlock(0);\n+\t\tPointOnLineConstraint *lineConstraint = new PointOnLineConstraint(ground, lineDirection, pointOnLine, *block, pointOnBlock);\n+\t\tosimModel.addConstraint(lineConstraint);\n+\n+\t\t// Add PistonActuator between the first linkage and the block\n+\t\tVec3 pointOnBodies(0);\n+\t\tPistonActuator *piston = new PistonActuator();\n+\t\tpiston->setName("piston");\n+\t\tpiston->setBodyA(linkage1);\n+\t\tpiston->setBodyB(block);\n+\t\tpiston->setPointA(pointOnBodies);\n+\t\tpiston->setPointB(pointOnBodies);\n+\t\tpiston->setOptimalForce(200.0);\n+\t\tpiston->setPointsAreGlobal(false);\n+\n+\t\tosimModel.addForce(piston);\n+\t\t//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+\t\t// Added ControllableSpring between the first linkage and the second block\n+\t\t//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+\t\tControllableSpring *spring = new ControllableSpring;\n+\t\tspring->setName("spring");\n+\t\tspring->setBodyA(block);\n+\t\tspring->setBodyB(linkage1);\n+\t\tspring->setPointA(pointOnBodies);\n+\t\tspring->setPointB(pointOnBodies);\n+\t\tspring->setOptimalForce(2000.0);\n+\t\tspring->setPointsAreGlobal(false);\n+\t\tspring->setRestLength(0.8);\n+\n+\t\tosimModel.addForce(spring);\n+\n+\t\t// define the simulation times\n+\t\tdouble t0(0.0), tf(15);\n+\n+\t\t// create a controller to control the piston and spring actuators\n+\t\t// the prescribed controller sets the controls as functions of time\n+\t\tPrescribedController *legController = new PrescribedController();\n+\t\t// give the legController control over all (two) model actuators\n+\t\tlegController->setActuators(osimModel.updActuators());\n+\n+\t\t// specify some control nodes for spring stiffness control\n+\t\tdouble t[] = {0.0, 4.0, 7.0,  10.0, 15.0};\n         double x[] = {1.0, 1.0, 0.25,  0.25, 5.0};\n \n-        // specify the control function for each actuator\n-        legController->prescribeControlForActuator("piston", new Constant(0.1));\n-        legController->prescribeControlForActuator("spring", new PiecewiseLinearFunction(5, t, x));\n-\n-        // add the controller to the model\n-        osimModel.addController(legController);     \n-        \n-        // define the acceration due to gravity\n-        osimModel.setGravity(Vec3(0, -9.80665, 0));\n-\n-        // enable the model visualizer see the model in action, which can be\n-        // useful for debugging\n-        osimModel.setUseVisualizer(false);\n-\n-        // Initialize system\n-        SimTK::State& si = osimModel.initSystem();\n-        \n-        // Pin joint initial states\n-        double q1_i = -Pi/4;\n-        double q2_i = - 2*q1_i;\n-        CoordinateSet &coordinates = osimModel.updCoordinateSet();\n-        coordinates[0].setValue(si, q1_i, true);\n-        coordinates[1].setValue(si,q2_i, true);\n-\n-        // Setup integrator and manager\n-        SimTK::RungeKuttaMersonIntegrator integrator(osimModel.getMultibodySystem());\n-        integrator.setAccuracy(1.0e-3);\n-\n-        ForceReporter *forces = new ForceReporter(&osimModel);  \n-        osimModel.updAnalysisSet().adoptAndAppend(forces);\n-        Manager manager(osimModel, integrator);\n-    \n-        //Examine the model\n-        osimModel.printDetailedInfo(si, std::cout);\n-        // Save the model\n-        osimModel.print("toyLeg.osim");\n-        // Print out the initial position and velocity states\n-        si.getQ().dump("Initial q\'s");\n-        si.getU().dump("Initial u\'s");\n-        std::cout << "Initial time: " << si.getTime() << std::endl;\n-\n-        // Integrate\n-        manager.setInitialTime(t0);\n-        manager.setFinalTime(tf);\n-        std::cout<<"\\n\\nIntegrating from " << t0 << " to " << tf << std::endl;\n-        manager.integrate(si);\n-\n-        // Save results\n-        osimModel.printControlStorage("SpringActuatedLeg_controls.sto");\n-        Storage statesDegrees(manager.getStateStorage());\n-        osimModel.updSimbodyEngine().convertRadiansToDegrees(statesDegrees);\n-        //statesDegrees.print("PistonActuatedLeg_states_degrees.mot");\n-        statesDegrees.print("SpringActuatedLeg_states_degrees.mot");\n-\n-        forces->getForceStorage().print("actuator_forces.mot");\n-        \n-    }\n+\t\t// specify the control function for each actuator\n+\t\tlegController->prescribeControlForActuator("piston", new Constant(0.1));\n+\t\tlegController->prescribeControlForActuator("spring", new PiecewiseLinearFunction(5, t, x));\n+\n+\t\t// add the controller to the model\n+\t\tosimModel.addController(legController);\t\t\n+\t\t\n+\t\t// define the acceration due to gravity\n+\t\tosimModel.setGravity(Vec3(0, -9.80665, 0));\n+\n+\t\t// enable the model visualizer see the model in action, which can be\n+\t\t// useful for debugging\n+\t\tosimModel.setUseVisualizer(false);\n+\n+\t\t// Initialize system\n+\t\tSimTK::State& si = osimModel.initSystem();\n+\t\t\n+\t\t// Pin joint initial states\n+\t\tdouble q1_i = -Pi/4;\n+\t\tdouble q2_i = - 2*q1_i;\n+\t\tCoordinateSet &coordinates = osimModel.updCoordinateSet();\n+\t\tcoordinates[0].setValue(si, q1_i, true);\n+\t\tcoordinates[1].setValue(si,q2_i, true);\n+\n+\t\t// Setup integrator and manager\n+\t\tSimTK::RungeKuttaMersonIntegrator integrator(osimModel.getMultibodySystem());\n+\t\tintegrator.setAccuracy(1.0e-3);\n+\n+\t\tForceReporter *forces = new ForceReporter(&osimModel);\t\n+\t\tosimModel.updAnalysisSet().adoptAndAppend(forces);\n+\t\tManager manager(osimModel, integrator);\n+\t\n+\t\t//Examine the model\n+\t\tosimModel.printDetailedInfo(si, std::cout);\n+\t\t// Save the model\n+\t\tosimModel.print("toyLeg.osim");\n+\t\t// Print out the initial position and velocity states\n+\t\tsi.getQ().dump("Initial q\'s");\n+\t\tsi.getU().dump("Initial u\'s");\n+\t\tstd::cout << "Initial time: " << si.getTime() << std::endl;\n+\n+\t\t// Integrate\n+\t\tmanager.setInitialTime(t0);\n+\t\tmanager.setFinalTime(tf);\n+\t\tstd::cout<<"\\n\\nIntegrating from " << t0 << " to " << tf << std::endl;\n+\t\tmanager.integrate(si);\n+\n+\t\t// Save results\n+\t\tosimModel.printControlStorage("SpringActuatedLeg_controls.sto");\n+\t\tStorage statesDegrees(manager.getStateStorage());\n+\t\tosimModel.updSimbodyEngine().convertRadiansToDegrees(statesDegrees);\n+\t\t//statesDegrees.print("PistonActuatedLeg_states_degrees.mot");\n+\t\tstatesDegrees.print("SpringActuatedLeg_states_degrees.mot");\n+\n+\t\tforces->getForceStorage().print("actuator_forces.mot");\n+\t\t\n+\t}\n     catch (const std::exception& ex)\n     {\n         std::cout << "Exception in toyLeg_example: " << ex.what() << std::endl;\n         return 1;\n     }\n \n-    std::cout << "Done." << std::endl;\n-    return 0;\n+\tstd::cout << "Done." << std::endl;\n+\treturn 0;\n }\ndiff --git a/OpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp b/OpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\nindex 3f875dcb7..865b623aa 100644\n--- a/OpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\n+++ b/OpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\n@@ -47,269 +47,270 @@ int main()\n {\n     clock_t startTime = clock();\n \n-    try {\n-        //////////////////////\n-        // MODEL PARAMETERS //\n-        //////////////////////\n+\ttry {\n+\t\t//////////////////////\n+\t\t// MODEL PARAMETERS //\n+\t\t//////////////////////\n \n-        // Specify body mass of a 20 kg, 0.1m sides of cubed block body\n-        double blockMass = 20.0, blockSideLength = 0.1;\n+\t\t// Specify body mass of a 20 kg, 0.1m sides of cubed block body\n+\t\tdouble blockMass = 20.0, blockSideLength = 0.1;\n \n-        // Constant distance of constraint to limit the block\'s motion\n-        double constantDistance = 0.2;\n+\t\t// Constant distance of constraint to limit the block\'s motion\n+\t\tdouble constantDistance = 0.2;\n \n-        // Contact parameters\n-        double stiffness = 1.0e7, dissipation = 0.1, friction = 0.2, viscosity=0.01;\n+\t\t// Contact parameters\n+\t\tdouble stiffness = 1.0e7, dissipation = 0.1, friction = 0.2, viscosity=0.01;\n \n-        ///////////////////////////////////////////\n-        // DEFINE BODIES AND JOINTS OF THE MODEL //\n-        ///////////////////////////////////////////\n+\t\t///////////////////////////////////////////\n+\t\t// DEFINE BODIES AND JOINTS OF THE MODEL //\n+\t\t///////////////////////////////////////////\n \n-        // Create an OpenSim model and set its name\n-        Model osimModel;\n-        osimModel.setName("tugOfWar");\n+\t\t// Create an OpenSim model and set its name\n+\t\tModel osimModel;\n+\t\tosimModel.setName("tugOfWar");\n \n-        // GROUND BODY\n+\t\t// GROUND BODY\n         // Get a reference to the model\'s ground frame\n         Ground& ground = osimModel.updGround();\n \n-        // Add display geometry to the ground to visualize in the Visualizer and GUI\n-        // add a checkered floor\n-        ground.addDisplayGeometry("checkered_floor.vtp");\n-        // add anchors for the muscles to be fixed too\n-        ground.addDisplayGeometry("block.vtp");\n-        ground.addDisplayGeometry("block.vtp");\n-\n-        // block is 0.1 by 0.1 by 0.1m cube and centered at origin. \n-        // transform anchors to be placed at the two extremes of the sliding block (to come)\n-        GeometrySet& geometry = ground.updDisplayer()->updGeometrySet();\n-        DisplayGeometry& anchor1 = geometry[1];\n-        DisplayGeometry& anchor2 = geometry[2];\n-        // scale the anchors\n-        anchor1.setScaleFactors(Vec3(5, 1, 1));\n-        anchor2.setScaleFactors(Vec3(5, 1, 1));\n-        // reposition the anchors\n-        anchor1.setTransform(Transform(Vec3(0, 0.05, 0.35)));\n-        anchor2.setTransform(Transform(Vec3(0, 0.05, -0.35)));\n-\n-        // BLOCK BODY\n-        Vec3 blockMassCenter(0);\n-        Inertia blockInertia = blockMass*Inertia::brick(blockSideLength, blockSideLength, blockSideLength);\n-\n-        // Create a new block body with the specified properties\n-        OpenSim::Body *block = new OpenSim::Body("block", blockMass, blockMassCenter, blockInertia);\n-\n-        // Add display geometry to the block to visualize in the GUI\n-        block->addDisplayGeometry("block.vtp");\n-\n-        // FREE JOINT\n-\n-        // Create a new free joint with 6 degrees-of-freedom (coordinates) between the block and ground bodies\n-        Vec3 locationInParent(0, blockSideLength/2, 0), orientationInParent(0), locationInBody(0), orientationInBody(0);\n-        FreeJoint *blockToGround = new FreeJoint("blockToGround", ground, locationInParent, orientationInParent, *block, locationInBody, orientationInBody);\n-        \n-        // Get a reference to the coordinate set (6 degrees-of-freedom) between the block and ground bodies\n-        CoordinateSet& jointCoordinateSet = blockToGround->upd_CoordinateSet();\n-\n-        // Set the angle and position ranges for the coordinate set\n-        double angleRange[2] = {-SimTK::Pi/2, SimTK::Pi/2};\n-        double positionRange[2] = {-1, 1};\n-        jointCoordinateSet[0].setRange(angleRange);\n-        jointCoordinateSet[1].setRange(angleRange);\n-        jointCoordinateSet[2].setRange(angleRange);\n-        jointCoordinateSet[3].setRange(positionRange);\n-        jointCoordinateSet[4].setRange(positionRange);\n-        jointCoordinateSet[5].setRange(positionRange);\n-\n-        // GRAVITY\n-        // Obtaine the default acceleration due to gravity\n-        Vec3 gravity = osimModel.getGravity();\n-\n-        // Define non-zero default states for the free joint\n-        jointCoordinateSet[3].setDefaultValue(constantDistance); // set x-translation value\n-        double h_start = blockMass*gravity[1]/(stiffness*blockSideLength*blockSideLength);\n-        jointCoordinateSet[4].setDefaultValue(h_start); // set y-translation which is height\n-\n-        // Add the block and joint to the model\n-        osimModel.addBody(block);\n-        osimModel.addJoint(blockToGround);\n-\n-        ///////////////////////////////////////////////\n-        // DEFINE THE SIMULATION START AND END TIMES //\n-        ///////////////////////////////////////////////\n-\n-        // Define the initial and final simulation times\n-        double initialTime = 0.0;\n-        double finalTime = 3.00;\n-\n-        /////////////////////////////////////////////\n-        // DEFINE CONSTRAINTS IMPOSED ON THE MODEL //\n-        /////////////////////////////////////////////\n-        Vec3 pointOnGround(0, blockSideLength/2 ,0);\n-        Vec3 pointOnBlock(0, 0, 0);\n-\n-        // Create a new constant distance constraint\n-        ConstantDistanceConstraint *constDist = \n-            new ConstantDistanceConstraint(ground, \n-                pointOnGround, *block, pointOnBlock, constantDistance);\n-\n-        // Add the new point on a line constraint to the model\n-        osimModel.addConstraint(constDist);\n-\n-        ///////////////////////////////////////\n-        // DEFINE FORCES ACTING ON THE MODEL //\n-        ///////////////////////////////////////\n-    \n-        // MUSCLE FORCES\n-        // Create two new muscles with identical properties\n-        double maxIsometricForce = 1000.0, optimalFiberLength = 0.25, tendonSlackLength = 0.1, pennationAngle = 0.0; \n-        Thelen2003Muscle *muscle1 = new Thelen2003Muscle("muscle1",maxIsometricForce,optimalFiberLength,tendonSlackLength,pennationAngle);\n-        Thelen2003Muscle *muscle2 = new Thelen2003Muscle("muscle2",maxIsometricForce,optimalFiberLength,tendonSlackLength,pennationAngle);\n-\n-        // Specify the paths for the two muscles\n-        // Path for muscle 1\n-        muscle1->addNewPathPoint("muscle1-point1", ground, Vec3(0.0,0.05,-0.35));\n-        muscle1->addNewPathPoint("muscle1-point2", *block, Vec3(0.0,0.0,-0.05));\n-        // Path for muscle 2\n-        muscle2->addNewPathPoint("muscle2-point1", ground, Vec3(0.0,0.05,0.35));\n-        muscle2->addNewPathPoint("muscle2-point2", *block, Vec3(0.0,0.0,0.05));\n-\n-        // Add the two muscles (as forces) to the model\n-        osimModel.addForce(muscle1);\n-        osimModel.addForce(muscle2);\n-\n-        // CONTACT FORCE\n-        // Define contact geometry\n-        // Create new floor contact halfspace\n-        ContactHalfSpace *floor = new ContactHalfSpace(SimTK::Vec3(0), SimTK::Vec3(0, 0, -0.5*SimTK_PI), ground, "floor");\n-        // Create new cube contact mesh\n-        OpenSim::ContactMesh *cube = new OpenSim::ContactMesh("blockMesh.obj", SimTK::Vec3(0), SimTK::Vec3(0), *block, "cube");\n-\n-        // Add contact geometry to the model\n-        osimModel.addContactGeometry(floor);\n-        osimModel.addContactGeometry(cube);\n-\n-        // Define contact parameters for elastic foundation force\n-        OpenSim::ElasticFoundationForce::ContactParameters *contactParams = \n-            new OpenSim::ElasticFoundationForce::ContactParameters(stiffness, dissipation, friction, friction, viscosity);\n-        contactParams->addGeometry("cube");\n-        contactParams->addGeometry("floor");\n-        \n-        // Create a new elastic foundation (contact) force between the floor and cube.\n-        OpenSim::ElasticFoundationForce *contactForce = new OpenSim::ElasticFoundationForce(contactParams);\n-        contactForce->setName("contactForce");\n-\n-        // Add the new elastic foundation force to the model\n-        osimModel.addForce(contactForce);\n-\n-        // PRESCRIBED FORCE\n-        // Create a new prescribed force to be applied to the block\n-        PrescribedForce *prescribedForce = new PrescribedForce(block);\n-        prescribedForce->setName("prescribedForce");\n-\n-        // Specify properties of the force function to be applied to the block\n-        double time[2] = {0, finalTime};                    // time nodes for linear function\n-        double fXofT[2] = {0,  -blockMass*gravity[1]*3.0};  // force values at t1 and t2\n-\n-        // Create linear function for the force components\n-        PiecewiseLinearFunction *forceX = new PiecewiseLinearFunction(2, time, fXofT);\n-        // Set the force and point functions for the new prescribed force\n-        prescribedForce->setForceFunctions(forceX, new Constant(0.0), new Constant(0.0));\n-        prescribedForce->setPointFunctions(new Constant(0.0), new Constant(0.0), new Constant(0.0));\n-\n-        // Add the new prescribed force to the model\n-        osimModel.addForce(prescribedForce);\n-\n-        ///////////////////////////////////\n-        // DEFINE CONTROLS FOR THE MODEL //\n-        ///////////////////////////////////\n-        // Create a prescribed controller that simply applies controls as function of time\n-        // For muscles, controls are normalized motor-neuron excitations\n-        PrescribedController *muscleController = new PrescribedController();\n-        muscleController->setActuators(osimModel.updActuators());\n-        // Define linear functions for the control values for the two muscles\n-        Array<double> slopeAndIntercept1(0.0, 2);  // array of 2 doubles\n-        Array<double> slopeAndIntercept2(0.0, 2);\n-        // muscle1 control has slope of -1 starting 1 at t = 0\n-        slopeAndIntercept1[0] = -1.0/(finalTime-initialTime);  slopeAndIntercept1[1] = 1.0;\n-        // muscle2 control has slope of 0.95 starting 0.05 at t = 0\n-        slopeAndIntercept2[0] = 0.95/(finalTime-initialTime);  slopeAndIntercept2[1] = 0.05;\n-        \n-        // Set the indiviudal muscle control functions for the prescribed muscle controller\n-        muscleController->prescribeControlForActuator("muscle1", new LinearFunction(slopeAndIntercept1));\n-        muscleController->prescribeControlForActuator("muscle2", new LinearFunction(slopeAndIntercept2));\n-\n-        // Add the muscle controller to the model\n-        osimModel.addController(muscleController);\n-\n-        ///////////////////////////////////\n-        // SPECIFY MODEL DEFAULT STATES  //\n-        ///////////////////////////////////\n-        // Define the default states for the two muscles\n-        // Activation\n-        muscle1->setDefaultActivation(slopeAndIntercept1[1]);\n-        muscle2->setDefaultActivation(slopeAndIntercept2[1]);\n-        // Fiber length\n-        muscle2->setDefaultFiberLength(optimalFiberLength);\n-        muscle1->setDefaultFiberLength(optimalFiberLength);\n-\n-        // Save the model to a file\n-        osimModel.print("tugOfWar_model.osim");\n-\n-        //////////////////////////\n-        // PERFORM A SIMULATION //\n-        //////////////////////////\n-\n-        // set use visualizer to true to visualize the simulation live\n-        osimModel.setUseVisualizer(false);\n-\n-        // Initialize the system and get the default state\n-        SimTK::State& si = osimModel.initSystem();\n-        \n-        // Enable constraint consistent with current configuration of the model\n-        constDist->setDisabled(si, false);\n-\n-        cout << "Start height = "<< h_start << endl;\n-        osimModel.getMultibodySystem().realize(si, Stage::Velocity);\n-\n-        // Compute initial conditions for muscles\n-        osimModel.equilibrateMuscles(si);\n-\n-        double mfv1 = muscle1->getFiberVelocity(si);\n-        double mfv2 = muscle2->getFiberVelocity(si);\n-\n-        // Create the force reporter for obtaining the forces applied to the model\n-        // during a forward simulation\n-        ForceReporter* reporter = new ForceReporter(&osimModel);\n-        osimModel.addAnalysis(reporter);\n-\n-        // Create the integrator for integrating system dynamics\n-        SimTK::RungeKuttaMersonIntegrator integrator(osimModel.getMultibodySystem());\n-        integrator.setAccuracy(1.0e-6);\n-        \n-        // Create the manager managing the forward integration and its outputs\n-        Manager manager(osimModel,  integrator);\n-\n-        // Print out details of the model\n-        osimModel.printDetailedInfo(si, cout);\n-\n-        // Integrate from initial time to final time\n-        manager.setInitialTime(initialTime);\n-        manager.setFinalTime(finalTime);\n-        cout<<"\\nIntegrating from "<<initialTime<<" to "<<finalTime<<endl;\n-        manager.integrate(si);\n-\n-        //////////////////////////////\n-        // SAVE THE RESULTS TO FILE //\n-        //////////////////////////////\n-        // Save the model states from forward integration\n-        Storage statesDegrees(manager.getStateStorage());\n-        statesDegrees.print("tugOfWar_states.sto");\n-\n-        // Save the forces\n-        reporter->getForceStorage().print("tugOfWar_forces.mot");\n-    }\n-    catch (const std::exception& ex)\n+\t\t// Add display geometry to the ground to visualize in the Visualizer and GUI\n+\t\t// add a checkered floor\n+\t\tground.addDisplayGeometry("checkered_floor.vtp");\n+\t\t// add anchors for the muscles to be fixed too\n+\t\tground.addDisplayGeometry("block.vtp");\n+\t\tground.addDisplayGeometry("block.vtp");\n+\n+\t\t// block is 0.1 by 0.1 by 0.1m cube and centered at origin. \n+\t\t// transform anchors to be placed at the two extremes of the sliding block (to come)\n+        /*\n+\t\tGeometrySet& geometry = ground.updDisplayer()->updGeometrySet();\n+\t\tDisplayGeometry& anchor1 = geometry[1];\n+\t\tDisplayGeometry& anchor2 = geometry[2];\n+\t\t// scale the anchors\n+\t\tanchor1.setScaleFactors(Vec3(5, 1, 1));\n+\t\tanchor2.setScaleFactors(Vec3(5, 1, 1));\n+\t\t// reposition the anchors\n+\t\tanchor1.setTransform(Transform(Vec3(0, 0.05, 0.35)));\n+\t\tanchor2.setTransform(Transform(Vec3(0, 0.05, -0.35)));\n+        */\n+\t\t// BLOCK BODY\n+\t\tVec3 blockMassCenter(0);\n+\t\tInertia blockInertia = blockMass*Inertia::brick(blockSideLength, blockSideLength, blockSideLength);\n+\n+\t\t// Create a new block body with the specified properties\n+\t\tOpenSim::Body *block = new OpenSim::Body("block", blockMass, blockMassCenter, blockInertia);\n+\n+\t\t// Add display geometry to the block to visualize in the GUI\n+\t\tblock->addDisplayGeometry("block.vtp");\n+\n+\t\t// FREE JOINT\n+\n+\t\t// Create a new free joint with 6 degrees-of-freedom (coordinates) between the block and ground bodies\n+\t\tVec3 locationInParent(0, blockSideLength/2, 0), orientationInParent(0), locationInBody(0), orientationInBody(0);\n+\t\tFreeJoint *blockToGround = new FreeJoint("blockToGround", ground, locationInParent, orientationInParent, *block, locationInBody, orientationInBody);\n+\t\t\n+\t\t// Get a reference to the coordinate set (6 degrees-of-freedom) between the block and ground bodies\n+\t\tCoordinateSet& jointCoordinateSet = blockToGround->upd_CoordinateSet();\n+\n+\t\t// Set the angle and position ranges for the coordinate set\n+\t\tdouble angleRange[2] = {-SimTK::Pi/2, SimTK::Pi/2};\n+\t\tdouble positionRange[2] = {-1, 1};\n+\t\tjointCoordinateSet[0].setRange(angleRange);\n+\t\tjointCoordinateSet[1].setRange(angleRange);\n+\t\tjointCoordinateSet[2].setRange(angleRange);\n+\t\tjointCoordinateSet[3].setRange(positionRange);\n+\t\tjointCoordinateSet[4].setRange(positionRange);\n+\t\tjointCoordinateSet[5].setRange(positionRange);\n+\n+\t\t// GRAVITY\n+\t\t// Obtaine the default acceleration due to gravity\n+\t\tVec3 gravity = osimModel.getGravity();\n+\n+\t\t// Define non-zero default states for the free joint\n+\t\tjointCoordinateSet[3].setDefaultValue(constantDistance); // set x-translation value\n+\t\tdouble h_start = blockMass*gravity[1]/(stiffness*blockSideLength*blockSideLength);\n+\t\tjointCoordinateSet[4].setDefaultValue(h_start); // set y-translation which is height\n+\n+\t\t// Add the block and joint to the model\n+\t\tosimModel.addBody(block);\n+\t\tosimModel.addJoint(blockToGround);\n+\n+\t\t///////////////////////////////////////////////\n+\t\t// DEFINE THE SIMULATION START AND END TIMES //\n+\t\t///////////////////////////////////////////////\n+\n+\t\t// Define the initial and final simulation times\n+\t\tdouble initialTime = 0.0;\n+\t\tdouble finalTime = 3.00;\n+\n+\t\t/////////////////////////////////////////////\n+\t\t// DEFINE CONSTRAINTS IMPOSED ON THE MODEL //\n+\t\t/////////////////////////////////////////////\n+\t\tVec3 pointOnGround(0, blockSideLength/2 ,0);\n+\t\tVec3 pointOnBlock(0, 0, 0);\n+\n+\t\t// Create a new constant distance constraint\n+\t\tConstantDistanceConstraint *constDist = \n+\t\t\tnew ConstantDistanceConstraint(ground, \n+\t\t\t\tpointOnGround, *block, pointOnBlock, constantDistance);\n+\n+\t\t// Add the new point on a line constraint to the model\n+\t\tosimModel.addConstraint(constDist);\n+\n+\t\t///////////////////////////////////////\n+\t\t// DEFINE FORCES ACTING ON THE MODEL //\n+\t\t///////////////////////////////////////\n+\t\n+\t\t// MUSCLE FORCES\n+\t\t// Create two new muscles with identical properties\n+\t\tdouble maxIsometricForce = 1000.0, optimalFiberLength = 0.25, tendonSlackLength = 0.1, pennationAngle = 0.0; \n+\t\tThelen2003Muscle *muscle1 = new Thelen2003Muscle("muscle1",maxIsometricForce,optimalFiberLength,tendonSlackLength,pennationAngle);\n+\t\tThelen2003Muscle *muscle2 = new Thelen2003Muscle("muscle2",maxIsometricForce,optimalFiberLength,tendonSlackLength,pennationAngle);\n+\n+\t\t// Specify the paths for the two muscles\n+\t\t// Path for muscle 1\n+\t\tmuscle1->addNewPathPoint("muscle1-point1", ground, Vec3(0.0,0.05,-0.35));\n+\t\tmuscle1->addNewPathPoint("muscle1-point2", *block, Vec3(0.0,0.0,-0.05));\n+\t\t// Path for muscle 2\n+\t\tmuscle2->addNewPathPoint("muscle2-point1", ground, Vec3(0.0,0.05,0.35));\n+\t\tmuscle2->addNewPathPoint("muscle2-point2", *block, Vec3(0.0,0.0,0.05));\n+\n+\t\t// Add the two muscles (as forces) to the model\n+\t\tosimModel.addForce(muscle1);\n+\t\tosimModel.addForce(muscle2);\n+\n+\t\t// CONTACT FORCE\n+\t\t// Define contact geometry\n+\t\t// Create new floor contact halfspace\n+\t\tContactHalfSpace *floor = new ContactHalfSpace(SimTK::Vec3(0), SimTK::Vec3(0, 0, -0.5*SimTK_PI), ground, "floor");\n+\t\t// Create new cube contact mesh\n+\t\tOpenSim::ContactMesh *cube = new OpenSim::ContactMesh("blockMesh.obj", SimTK::Vec3(0), SimTK::Vec3(0), *block, "cube");\n+\n+\t\t// Add contact geometry to the model\n+\t\tosimModel.addContactGeometry(floor);\n+\t\tosimModel.addContactGeometry(cube);\n+\n+\t\t// Define contact parameters for elastic foundation force\n+\t\tOpenSim::ElasticFoundationForce::ContactParameters *contactParams = \n+\t\t\tnew OpenSim::ElasticFoundationForce::ContactParameters(stiffness, dissipation, friction, friction, viscosity);\n+\t\tcontactParams->addGeometry("cube");\n+\t\tcontactParams->addGeometry("floor");\n+\t\t\n+\t\t// Create a new elastic foundation (contact) force between the floor and cube.\n+\t\tOpenSim::ElasticFoundationForce *contactForce = new OpenSim::ElasticFoundationForce(contactParams);\n+\t\tcontactForce->setName("contactForce");\n+\n+\t\t// Add the new elastic foundation force to the model\n+\t\tosimModel.addForce(contactForce);\n+\n+\t\t// PRESCRIBED FORCE\n+\t\t// Create a new prescribed force to be applied to the block\n+\t\tPrescribedForce *prescribedForce = new PrescribedForce(block);\n+\t\tprescribedForce->setName("prescribedForce");\n+\n+\t\t// Specify properties of the force function to be applied to the block\n+\t\tdouble time[2] = {0, finalTime};\t\t\t\t\t// time nodes for linear function\n+\t\tdouble fXofT[2] = {0,  -blockMass*gravity[1]*3.0};\t// force values at t1 and t2\n+\n+\t\t// Create linear function for the force components\n+\t\tPiecewiseLinearFunction *forceX = new PiecewiseLinearFunction(2, time, fXofT);\n+\t\t// Set the force and point functions for the new prescribed force\n+\t\tprescribedForce->setForceFunctions(forceX, new Constant(0.0), new Constant(0.0));\n+\t\tprescribedForce->setPointFunctions(new Constant(0.0), new Constant(0.0), new Constant(0.0));\n+\n+\t\t// Add the new prescribed force to the model\n+\t\tosimModel.addForce(prescribedForce);\n+\n+\t\t///////////////////////////////////\n+\t\t// DEFINE CONTROLS FOR THE MODEL //\n+\t\t///////////////////////////////////\n+\t\t// Create a prescribed controller that simply applies controls as function of time\n+\t\t// For muscles, controls are normalized motor-neuron excitations\n+\t\tPrescribedController *muscleController = new PrescribedController();\n+\t\tmuscleController->setActuators(osimModel.updActuators());\n+\t\t// Define linear functions for the control values for the two muscles\n+\t\tArray<double> slopeAndIntercept1(0.0, 2);  // array of 2 doubles\n+\t\tArray<double> slopeAndIntercept2(0.0, 2);\n+\t\t// muscle1 control has slope of -1 starting 1 at t = 0\n+\t\tslopeAndIntercept1[0] = -1.0/(finalTime-initialTime);  slopeAndIntercept1[1] = 1.0;\n+\t\t// muscle2 control has slope of 0.95 starting 0.05 at t = 0\n+\t\tslopeAndIntercept2[0] = 0.95/(finalTime-initialTime);  slopeAndIntercept2[1] = 0.05;\n+\t\t\n+\t\t// Set the indiviudal muscle control functions for the prescribed muscle controller\n+\t\tmuscleController->prescribeControlForActuator("muscle1", new LinearFunction(slopeAndIntercept1));\n+\t\tmuscleController->prescribeControlForActuator("muscle2", new LinearFunction(slopeAndIntercept2));\n+\n+\t\t// Add the muscle controller to the model\n+\t\tosimModel.addController(muscleController);\n+\n+\t\t///////////////////////////////////\n+\t\t// SPECIFY MODEL DEFAULT STATES  //\n+\t\t///////////////////////////////////\n+\t\t// Define the default states for the two muscles\n+\t\t// Activation\n+\t\tmuscle1->setDefaultActivation(slopeAndIntercept1[1]);\n+\t\tmuscle2->setDefaultActivation(slopeAndIntercept2[1]);\n+\t\t// Fiber length\n+\t\tmuscle2->setDefaultFiberLength(optimalFiberLength);\n+\t\tmuscle1->setDefaultFiberLength(optimalFiberLength);\n+\n+\t\t// Save the model to a file\n+\t\tosimModel.print("tugOfWar_model.osim");\n+\n+\t\t//////////////////////////\n+\t\t// PERFORM A SIMULATION //\n+\t\t//////////////////////////\n+\n+\t\t// set use visualizer to true to visualize the simulation live\n+\t\tosimModel.setUseVisualizer(false);\n+\n+\t\t// Initialize the system and get the default state\n+\t\tSimTK::State& si = osimModel.initSystem();\n+\t\t\n+\t\t// Enable constraint consistent with current configuration of the model\n+\t\tconstDist->setDisabled(si, false);\n+\n+\t\tcout << "Start height = "<< h_start << endl;\n+\t\tosimModel.getMultibodySystem().realize(si, Stage::Velocity);\n+\n+\t\t// Compute initial conditions for muscles\n+\t\tosimModel.equilibrateMuscles(si);\n+\n+\t\tdouble mfv1 = muscle1->getFiberVelocity(si);\n+\t\tdouble mfv2 = muscle2->getFiberVelocity(si);\n+\n+\t\t// Create the force reporter for obtaining the forces applied to the model\n+\t\t// during a forward simulation\n+\t\tForceReporter* reporter = new ForceReporter(&osimModel);\n+\t\tosimModel.addAnalysis(reporter);\n+\n+\t\t// Create the integrator for integrating system dynamics\n+\t\tSimTK::RungeKuttaMersonIntegrator integrator(osimModel.getMultibodySystem());\n+\t\tintegrator.setAccuracy(1.0e-6);\n+\t\t\n+\t\t// Create the manager managing the forward integration and its outputs\n+\t\tManager manager(osimModel,  integrator);\n+\n+\t\t// Print out details of the model\n+\t\tosimModel.printDetailedInfo(si, cout);\n+\n+\t\t// Integrate from initial time to final time\n+\t\tmanager.setInitialTime(initialTime);\n+\t\tmanager.setFinalTime(finalTime);\n+\t\tcout<<"\\nIntegrating from "<<initialTime<<" to "<<finalTime<<endl;\n+\t\tmanager.integrate(si);\n+\n+\t\t//////////////////////////////\n+\t\t// SAVE THE RESULTS TO FILE //\n+\t\t//////////////////////////////\n+\t\t// Save the model states from forward integration\n+\t\tStorage statesDegrees(manager.getStateStorage());\n+\t\tstatesDegrees.print("tugOfWar_states.sto");\n+\n+\t\t// Save the forces\n+\t\treporter->getForceStorage().print("tugOfWar_forces.mot");\n+\t}\n+\tcatch (const std::exception& ex)\n     {\n         cerr << ex.what() << endl;\n         return 1;\n@@ -324,5 +325,5 @@ int main()\n \n     cout << "OpenSim example completed successfully." << endl;\n \n-    return 0;\n+\treturn 0;\n }\ndiff --git a/OpenSim/Simulation/Model/Actuator.h b/OpenSim/Simulation/Model/Actuator.h\nindex 7be2e97d5..4dd890042 100644\n--- a/OpenSim/Simulation/Model/Actuator.h\n+++ b/OpenSim/Simulation/Model/Actuator.h\n@@ -37,7 +37,6 @@\n namespace OpenSim {\n \n class Model;\n-class VisibleObject;\n class Controller;\n class Coordinate;\n \ndiff --git a/OpenSim/Simulation/Model/ConditionalPathPoint.h b/OpenSim/Simulation/Model/ConditionalPathPoint.h\nindex 01d5a0802..38f83f824 100644\n--- a/OpenSim/Simulation/Model/ConditionalPathPoint.h\n+++ b/OpenSim/Simulation/Model/ConditionalPathPoint.h\n@@ -29,7 +29,6 @@\n #include <string>\n #include <math.h>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDblArray.h>\n #include <OpenSim/Common/PropertyStr.h>\n #include <OpenSim/Common/Storage.h>\ndiff --git a/OpenSim/Simulation/Model/ContactGeometry.cpp b/OpenSim/Simulation/Model/ContactGeometry.cpp\nindex 15d50d272..edfa40ec1 100644\n--- a/OpenSim/Simulation/Model/ContactGeometry.cpp\n+++ b/OpenSim/Simulation/Model/ContactGeometry.cpp\n@@ -41,7 +41,7 @@ namespace OpenSim {\n // Default constructor.\n ContactGeometry::ContactGeometry() : ModelComponent()\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n }\n \n@@ -50,7 +50,7 @@ ContactGeometry::ContactGeometry() : ModelComponent()\n ContactGeometry::ContactGeometry(const Vec3& location, const Vec3& orientation, \n     PhysicalFrame& body) : ModelComponent()\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n \n     _body = &body;\n@@ -61,7 +61,7 @@ ContactGeometry::ContactGeometry(const Vec3& location, const Vec3& orientation,\n \n void ContactGeometry::setNull()\n {\n-    setAuthors("Peter Eastman");\n+\tsetAuthors("Peter Eastman");\n }\n \n \n@@ -77,7 +77,7 @@ void ContactGeometry::constructProperties()\n     constructProperty_display_preference(1);\n \n     Array<double> defaultColor(1.0, 3); //color default to 0, 1, 1\n-    defaultColor[0] = 0.0; \n+\tdefaultColor[0] = 0.0; \n     constructProperty_color(defaultColor);\n }\n \n@@ -155,15 +155,11 @@ void ContactGeometry::extendConnectToModel(Model& aModel)\n         _body =\n             static_cast<PhysicalFrame*>(&updModel().updComponent(get_body_name()));\n     }\n-    catch (...)\n+\tcatch (...)\n     {\n         std::string errorMessage = "Invalid body (" + get_body_name() + ") specified in contact geometry " + getName();\n-        throw (Exception(errorMessage.c_str()));\n-    }\n-\n-    _body->updDisplayer()->addDependent(updDisplayer());\n-    _displayer.setTransform(getTransform());\n-    _displayer.setOwner(this);\n+\t\tthrow (Exception(errorMessage.c_str()));\n+\t}\n }\n \n void ContactGeometry::scale(const ScaleSet& aScaleSet)\ndiff --git a/OpenSim/Simulation/Model/ContactGeometry.h b/OpenSim/Simulation/Model/ContactGeometry.h\nindex 76577b847..efad3d732 100644\n--- a/OpenSim/Simulation/Model/ContactGeometry.h\n+++ b/OpenSim/Simulation/Model/ContactGeometry.h\n@@ -47,26 +47,25 @@ OpenSim_DECLARE_ABSTRACT_OBJECT(ContactGeometry, ModelComponent);\n //=============================================================================\n protected:\n     SimTK::ReferencePtr<PhysicalFrame> _body;\n-    VisibleObject   _displayer;\n \n //=============================================================================\n // METHODS\n //=============================================================================\n public:\n-    // CONSTRUCTION\n-    /**\n-     * Construct an empty ContactGeometry.  This constructor is protected, and is used\n-     * by subclasses.\n-     */\n-    ContactGeometry();\n-    /**\n-     * Construct a ContactGeometry.  This constructor is protected, and is used\n-     * by subclasses.\n-     *\n-     * @param location     the location of the geometry within the Body it is attached to\n-     * @param orientation  the orientation of the geometry within the Body it is attached to\n-     * @param body         the Body this geometry is attached to\n-     */\n+\t// CONSTRUCTION\n+\t/**\n+\t * Construct an empty ContactGeometry.  This constructor is protected, and is used\n+\t * by subclasses.\n+\t */\n+\tContactGeometry();\n+\t/**\n+\t * Construct a ContactGeometry.  This constructor is protected, and is used\n+\t * by subclasses.\n+\t *\n+\t * @param location     the location of the geometry within the Body it is attached to\n+\t * @param orientation  the orientation of the geometry within the Body it is attached to\n+\t * @param body         the Body this geometry is attached to\n+\t */\n     ContactGeometry(const SimTK::Vec3& location, const SimTK::Vec3& orientation, PhysicalFrame& body);\n \n \n@@ -91,57 +90,57 @@ public:\n         "Display Color");\n \n \n-    // ACCESSORS\n-    /**\n-     * Get the location of the geometry within the Body it is attached to.\n-     */\n-    const SimTK::Vec3& getLocation() const;\n-    /**\n-     * Set the location of the geometry within the Body it is attached to.\n-     */\n-    void setLocation(const SimTK::Vec3& location);\n-    /**\n-     * Get the orientation of the geometry within the Body it is attached to.\n-     */\n-    const SimTK::Vec3& getOrientation() const;\n-    /**\n-     * Set the orientation of the geometry within the Body it is attached to.\n-     */\n-    void setOrientation(const SimTK::Vec3& orientation);\n+\t// ACCESSORS\n+\t/**\n+\t * Get the location of the geometry within the Body it is attached to.\n+\t */\n+\tconst SimTK::Vec3& getLocation() const;\n+\t/**\n+\t * Set the location of the geometry within the Body it is attached to.\n+\t */\n+\tvoid setLocation(const SimTK::Vec3& location);\n+\t/**\n+\t * Get the orientation of the geometry within the Body it is attached to.\n+\t */\n+\tconst SimTK::Vec3& getOrientation() const;\n+\t/**\n+\t * Set the orientation of the geometry within the Body it is attached to.\n+\t */\n+\tvoid setOrientation(const SimTK::Vec3& orientation);\n #ifndef SWIG\n-    /**\n-     * Get the Body this geometry is attached to.\n-     */\n+\t/**\n+\t * Get the Body this geometry is attached to.\n+\t */\n     const PhysicalFrame& getBody() const;\n #endif\n-    /**\n+\t/**\n      * Get a writeable reference to the Body this geometry is attached to.\n-     */\n+\t */\n     OpenSim::PhysicalFrame& updBody();\n-    /**\n-     * Set the Body this geometry is attached to.\n-     */\n+\t/**\n+\t * Set the Body this geometry is attached to.\n+\t */\n     void setBody(PhysicalFrame& body);\n-    /**\n-     * Get the name of the Body this geometry is attached to.\n-     */\n+\t/**\n+\t * Get the name of the Body this geometry is attached to.\n+\t */\n     const std::string& getBodyName();\n-    /**\n-     * Set the name of the Body this geometry is attached to.  This will cause the\n+\t/**\n+\t * Set the name of the Body this geometry is attached to.  This will cause the\n      * Body to be set to NULL, then resolved when extendConnectToModel() is called.\n-     */\n+\t */\n     void setBodyName(const std::string& name);\n     /**\n-     * Get the display_preference of this geometry.\n-     */\n+\t * Get the display_preference of this geometry.\n+\t */\n     const int getDisplayPreference();\n     /**\n-     * Set the display_preference of this geometry.\n-     */\n+\t * Set the display_preference of this geometry.\n+\t */\n     void setDisplayPreference(const int dispPref);\n-    /**\n-     * Create a new SimTK::ContactGeometry based on this object.\n-     */\n+\t/**\n+\t * Create a new SimTK::ContactGeometry based on this object.\n+\t */\n     virtual SimTK::ContactGeometry createSimTKContactGeometry() = 0;\n     /**\n      * Get a Transform representing the position and orientation of the geometry\n@@ -149,29 +148,26 @@ public:\n      */\n     SimTK::Transform getTransform();\n \n-    /**\n-    * Scale a ContactGeometry based on XYZ scale factors for the bodies.\n-    * \n-    * @param aScaleSet Set of XYZ scale factors for the bodies.\n-    */\n-    virtual void scale(const ScaleSet& aScaleSet);\n-\n-    // Visible Object Support\n-    virtual const VisibleObject* getDisplayer() const { return &_displayer; };\n-    virtual VisibleObject* updDisplayer() { return &_displayer; };\n-    // Override this method if geometry changes/deforms\n-    virtual void updateGeometry() {};\n+\t/**\n+\t* Scale a ContactGeometry based on XYZ scale factors for the bodies.\n+\t* \n+\t* @param aScaleSet Set of XYZ scale factors for the bodies.\n+\t*/\n+\tvirtual void scale(const ScaleSet& aScaleSet);\n+\n+\t// Override this method if geometry changes/deforms\n+\tvirtual void updateGeometry() {};\n \n protected:\n-    // ModelComponent interface\n+\t// ModelComponent interface\n     void extendConnectToModel(Model& aModel) override;\n \n private:\n     // INITIALIZATION\n-    void setNull();\n+\tvoid setNull();\n     void constructProperties();\n //=============================================================================\n-};  // END of class ContactGeometry\n+};\t// END of class ContactGeometry\n //=============================================================================\n //=============================================================================\n \ndiff --git a/OpenSim/Simulation/Model/ContactHalfSpace.cpp b/OpenSim/Simulation/Model/ContactHalfSpace.cpp\nindex f82ed47d8..d969d1432 100644\n--- a/OpenSim/Simulation/Model/ContactHalfSpace.cpp\n+++ b/OpenSim/Simulation/Model/ContactHalfSpace.cpp\n@@ -56,15 +56,13 @@ ContactHalfSpace::ContactHalfSpace(const ContactHalfSpace& geom) :\n \n void ContactHalfSpace::setNull()\n {\n-    setAuthors("Peter Eastman");\n+\tsetAuthors("Peter Eastman");\n }\n \n \n SimTK::ContactGeometry ContactHalfSpace::createSimTKContactGeometry()\n {\n-    _displayer.freeGeometry();\n-    _displayer.addGeometry(new PolyhedralGeometry("unit_plane.obj"));\n-    return SimTK::ContactGeometry::HalfSpace();\n+\treturn SimTK::ContactGeometry::HalfSpace();\n }\n \n } // end of namespace OpenSim\ndiff --git a/OpenSim/Simulation/Model/ContactMesh.cpp b/OpenSim/Simulation/Model/ContactMesh.cpp\nindex b4288ed81..d15091779 100644\n--- a/OpenSim/Simulation/Model/ContactMesh.cpp\n+++ b/OpenSim/Simulation/Model/ContactMesh.cpp\n@@ -42,19 +42,19 @@ ContactMesh::ContactMesh(const std::string& filename, const SimTK::Vec3& locatio\n     _filename(_filenameProp.getValueStr()),\n     _geometry(NULL)\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n     setFilename(filename);\n-    if (filename != ""){\n-        std::ifstream file;\n-        file.open(filename.c_str());\n-        if (file.fail())\n-            throw Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\\n Model loading is aborted.");\n-        SimTK::PolygonalMesh mesh;\n-        mesh.loadObjFile(file);\n-        file.close();\n-        _geometry = new SimTK::ContactGeometry::TriangleMesh(mesh);\n-    }\n+\tif (filename != ""){\n+\t\tstd::ifstream file;\n+\t\tfile.open(filename.c_str());\n+\t\tif (file.fail())\n+\t\t\tthrow Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\\n Model loading is aborted.");\n+\t\tSimTK::PolygonalMesh mesh;\n+\t\tmesh.loadObjFile(file);\n+\t\tfile.close();\n+\t\t_geometry = new SimTK::ContactGeometry::TriangleMesh(mesh);\n+\t}\n }\n \n ContactMesh::ContactMesh(const std::string& filename, const SimTK::Vec3& location, const SimTK::Vec3& orientation, Body& body, const std::string& name) :\n@@ -62,17 +62,17 @@ ContactMesh::ContactMesh(const std::string& filename, const SimTK::Vec3& locatio\n     _filename(_filenameProp.getValueStr()),\n     _geometry(NULL)\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n     setFilename(filename);\n     setName(name);\n-    if (filename != ""){\n-        std::ifstream file;\n-        file.open(filename.c_str());\n-        if (file.fail())\n-            throw Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\\n Loading is aborted.");\n-        file.close();\n-    }\n+\tif (filename != ""){\n+\t\tstd::ifstream file;\n+\t\tfile.open(filename.c_str());\n+\t\tif (file.fail())\n+\t\t\tthrow Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\\n Loading is aborted.");\n+\t\tfile.close();\n+\t}\n }\n \n ContactMesh::ContactMesh(const ContactMesh& geom) :\n@@ -80,20 +80,20 @@ ContactMesh::ContactMesh(const ContactMesh& geom) :\n     _filename(_filenameProp.getValueStr()),\n     _geometry(NULL)\n {\n-    setNull();\n-    setupProperties();\n-    _filename = geom._filename;\n+\tsetNull();\n+\tsetupProperties();\n+\t_filename = geom._filename;\n }\n \n void ContactMesh::setNull()\n {\n-    setAuthors("Peter Eastman");\n+\tsetAuthors("Peter Eastman");\n }\n \n void ContactMesh::setupProperties()\n {\n-    _filenameProp.setName("filename");\n-    _propertySet.append(&_filenameProp);\n+\t_filenameProp.setName("filename");\n+\t_propertySet.append(&_filenameProp);\n }\n \n const std::string& ContactMesh::getFilename() const\n@@ -112,28 +112,27 @@ void ContactMesh::setFilename(const std::string& filename)\n \n void ContactMesh::loadMesh(const std::string& filename)\n {\n-    if (_geometry==NULL){\n-        SimTK::PolygonalMesh mesh;\n-        std::ifstream file;\n-        assert (_model);\n-        const std::string& savedCwd = IO::getCwd();\n-        bool restoreDirectory = false;\n-        if ((_model->getInputFileName()!="") && (_model->getInputFileName()!="Unassigned")) {\n-            std::string parentDirectory = IO::getParentDirectory(_model->getInputFileName());\n-            IO::chDir(parentDirectory);\n-            restoreDirectory=true;\n-        }\n-        file.open(filename.c_str());\n-        if (file.fail()){\n-            if (restoreDirectory) IO::chDir(savedCwd);\n-            throw Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\\n Loading is aborted.");\n-        }\n-        mesh.loadObjFile(file);\n-        file.close();\n-        if (restoreDirectory) IO::chDir(savedCwd);\n-        _geometry = new SimTK::ContactGeometry::TriangleMesh(mesh);\n-    }\n-    _displayer.addGeometry(new PolyhedralGeometry(filename));\n+\tif (_geometry==NULL){\n+\t\tSimTK::PolygonalMesh mesh;\n+\t\tstd::ifstream file;\n+\t\tassert (_model);\n+\t\tconst std::string& savedCwd = IO::getCwd();\n+\t\tbool restoreDirectory = false;\n+\t\tif ((_model->getInputFileName()!="") && (_model->getInputFileName()!="Unassigned")) {\n+\t\t\tstd::string parentDirectory = IO::getParentDirectory(_model->getInputFileName());\n+\t\t\tIO::chDir(parentDirectory);\n+\t\t\trestoreDirectory=true;\n+\t\t}\n+\t\tfile.open(filename.c_str());\n+\t\tif (file.fail()){\n+\t\t\tif (restoreDirectory) IO::chDir(savedCwd);\n+\t\t\tthrow Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\\n Loading is aborted.");\n+\t\t}\n+\t\tmesh.loadObjFile(file);\n+\t\tfile.close();\n+\t\tif (restoreDirectory) IO::chDir(savedCwd);\n+\t\t_geometry = new SimTK::ContactGeometry::TriangleMesh(mesh);\n+\t}\n \n }\n \ndiff --git a/OpenSim/Simulation/Model/ContactSphere.cpp b/OpenSim/Simulation/Model/ContactSphere.cpp\nindex 23492652e..496cfca8b 100644\n--- a/OpenSim/Simulation/Model/ContactSphere.cpp\n+++ b/OpenSim/Simulation/Model/ContactSphere.cpp\n@@ -22,6 +22,7 @@\n  * -------------------------------------------------------------------------- */\n \n #include "ContactSphere.h"\n+using SimTK::Transform;\n \n namespace OpenSim {\n \n@@ -36,8 +37,8 @@ ContactSphere::ContactSphere(double radius, const SimTK::Vec3& location, Body& b\n     ContactGeometry(location, SimTK::Vec3(0.0), body),\n     _radius(_radiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n     _radius = radius;\n }\n \n@@ -45,8 +46,8 @@ ContactSphere::ContactSphere(double radius, const SimTK::Vec3& location, Body& b\n     ContactGeometry(location, SimTK::Vec3(0.0), body),\n     _radius(_radiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n     _radius = radius;\n     setName(name);\n }\n@@ -55,20 +56,20 @@ ContactSphere::ContactSphere(const ContactSphere& geom) :\n     ContactGeometry(geom),\n     _radius(_radiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n-    _radius = geom._radius;\n+\tsetNull();\n+\tsetupProperties();\n+\t_radius = geom._radius;\n }\n \n void ContactSphere::setNull()\n {\n-    setAuthors("Peter Eastman");\n+\tsetAuthors("Peter Eastman");\n }\n \n void ContactSphere::setupProperties()\n {\n-    _radiusProp.setName("radius");\n-    _propertySet.append(&_radiusProp);\n+\t_radiusProp.setName("radius");\n+\t_propertySet.append(&_radiusProp);\n }\n \n \n@@ -84,7 +85,6 @@ void ContactSphere::setRadius(double radius)\n \n SimTK::ContactGeometry ContactSphere::createSimTKContactGeometry()\n {\n-    _displayer.addGeometry(AnalyticSphere::createSphere(_radius));\n     return SimTK::ContactGeometry::Sphere(_radius);\n }\n \ndiff --git a/OpenSim/Simulation/Model/ContactSphere.h b/OpenSim/Simulation/Model/ContactSphere.h\nindex 0d0338712..de103a180 100644\n--- a/OpenSim/Simulation/Model/ContactSphere.h\n+++ b/OpenSim/Simulation/Model/ContactSphere.h\n@@ -23,6 +23,7 @@\n  * limitations under the License.                                             *\n  * -------------------------------------------------------------------------- */\n // INCLUDE\n+#include <OpenSim/Common/PropertyDbl.h>\n #include "ContactGeometry.h"\n \n namespace OpenSim {\ndiff --git a/OpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp b/OpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp\nindex a6dea83d2..2a2285498 100644\n--- a/OpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp\n+++ b/OpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp\n@@ -53,7 +53,7 @@ std::string to_string(T const& value) {\n // Default constructor.\n ExpressionBasedBushingForce::ExpressionBasedBushingForce()\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n }\n \n@@ -61,19 +61,19 @@ ExpressionBasedBushingForce::ExpressionBasedBushingForce()\n ExpressionBasedBushingForce::ExpressionBasedBushingForce(const string&    body1Name, \n                            const Vec3&      point1, \n                            const Vec3&      orientation1,\n-                           const string&    body2Name, \n+\t\t                   const string&    body2Name, \n                            const Vec3&      point2, \n                            const Vec3&      orientation2)\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n \n-    set_body_1(body1Name);\n-    set_body_2(body2Name);\n-    set_location_body_1(point1);\n-    set_orientation_body_1(orientation1);\n-    set_location_body_2(point2);\n-    set_orientation_body_2(orientation2);\n+\tset_body_1(body1Name);\n+\tset_body_2(body2Name);\n+\tset_location_body_1(point1);\n+\tset_orientation_body_1(orientation1);\n+\tset_location_body_2(point2);\n+\tset_orientation_body_2(orientation2);\n     \n }\n \n@@ -81,43 +81,43 @@ ExpressionBasedBushingForce::ExpressionBasedBushingForce(const string&    body1N\n ExpressionBasedBushingForce::ExpressionBasedBushingForce(const string&    body1Name, \n                            const Vec3&      point1, \n                            const Vec3&      orientation1,\n-                           const string&    body2Name, \n+\t\t                   const string&    body2Name, \n                            const Vec3&      point2, \n                            const Vec3&      orientation2,\n-                           const Vec3&      transStiffness, \n+\t\t\t\t           const Vec3&      transStiffness, \n                            const Vec3&      rotStiffness, \n                            const Vec3&      transDamping, \n                            const Vec3&      rotDamping)\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n \n-    set_body_1(body1Name);\n-    set_body_2(body2Name);\n-    set_location_body_1(point1);\n-    set_orientation_body_1(orientation1);\n-    set_location_body_2(point2);\n-    set_orientation_body_2(orientation2);\n+\tset_body_1(body1Name);\n+\tset_body_2(body2Name);\n+\tset_location_body_1(point1);\n+\tset_orientation_body_1(orientation1);\n+\tset_location_body_2(point2);\n+\tset_orientation_body_2(orientation2);\n     // populate moments and forces as linear (ramp) expressions based on stiffness\n-    \n+\t\n     setMxExpression( to_string(rotStiffness[0]) + string("*theta_x") );\n     setMyExpression( to_string(rotStiffness[1]) + string("*theta_y") );\n     setMzExpression( to_string(rotStiffness[2]) + string("*theta_z") );\n-    setFxExpression( to_string(transStiffness[0]) + string("*delta_x") );\n-    setFyExpression( to_string(transStiffness[1]) + string("*delta_y") );\n-    setFzExpression( to_string(transStiffness[2]) + string("*delta_z") );\n-    set_rotational_damping(rotDamping);\n-    set_translational_damping(transDamping);\n-    \n+\tsetFxExpression( to_string(transStiffness[0]) + string("*delta_x") );\n+\tsetFyExpression( to_string(transStiffness[1]) + string("*delta_y") );\n+\tsetFzExpression( to_string(transStiffness[2]) + string("*delta_z") );\n+\tset_rotational_damping(rotDamping);\n+\tset_translational_damping(transDamping);\n+\t\n }\n \n //_____________________________________________________________________________\n // Set the data members of this ExpressionBasedBushingForce to their null values.\n void ExpressionBasedBushingForce::setNull()\n {\n-    setAuthors("Matt DeMers");\n+\tsetAuthors("Matt DeMers");\n     _b1 = NULL;\n-    _b2 = NULL;\n+\t_b2 = NULL;\n     // no data members\n \n }\n@@ -126,33 +126,33 @@ void ExpressionBasedBushingForce::setNull()\n // Allocate and initialize properties.\n void ExpressionBasedBushingForce::constructProperties()\n {\n-    constructProperty_body_1();\n-    constructProperty_body_2();\n+\tconstructProperty_body_1();\n+\tconstructProperty_body_2();\n \n-    //Default location and orientation (rotation sequence)\n-    constructProperty_location_body_1(Vec3(0)); // body origin\n-    constructProperty_orientation_body_1(Vec3(0)); // no rotation\n-    constructProperty_location_body_2(Vec3(0));\n-    constructProperty_orientation_body_2(Vec3(0));\n+\t//Default location and orientation (rotation sequence)\n+\tconstructProperty_location_body_1(Vec3(0)); // body origin\n+\tconstructProperty_orientation_body_1(Vec3(0)); // no rotation\n+\tconstructProperty_location_body_2(Vec3(0));\n+\tconstructProperty_orientation_body_2(Vec3(0));\n \n     //set all deflection functions to zero\n-    std::string zero = "0.0";\n+\tstd::string zero = "0.0";\n     constructProperty_Mx_expression( zero );\n     constructProperty_My_expression( zero );\n     constructProperty_Mz_expression( zero );\n     constructProperty_Fx_expression( zero );\n     constructProperty_Fy_expression( zero );\n     constructProperty_Fz_expression( zero );\n-    setMxExpression( "0.0" );\n+\tsetMxExpression( "0.0" );\n     setMyExpression( "0.0" );\n     setMzExpression( "0.0" );\n-    setFxExpression( "0.0" );\n-    setFyExpression( "0.0" );\n-    setFzExpression( "0.0" );\n+\tsetFxExpression( "0.0" );\n+\tsetFyExpression( "0.0" );\n+\tsetFzExpression( "0.0" );\n     \n     constructProperty_rotational_damping(Vec3(0));\n-    constructProperty_translational_damping(Vec3(0));\n-    \n+\tconstructProperty_translational_damping(Vec3(0));\n+\t\n     constructProperty_moment_visual_scale( 1.0 );\n     constructProperty_force_visual_scale( 1.0 );\n     constructProperty_visual_aspect_ratio(1.0);\n@@ -169,66 +169,66 @@ void ExpressionBasedBushingForce::extendConnectToModel(Model& aModel)\n {\n     Super::extendConnectToModel(aModel); // base class first\n \n-    // must initialize the 6 force functions using the user provided expressions\n-    setMxExpression(get_Mx_expression());\n-    setMyExpression(get_My_expression());\n-    setMzExpression(get_Mz_expression());\n-    setFxExpression(get_Fx_expression());\n-    setFyExpression(get_Fy_expression());\n-    setFzExpression(get_Fz_expression());\n+\t// must initialize the 6 force functions using the user provided expressions\n+\tsetMxExpression(get_Mx_expression());\n+\tsetMyExpression(get_My_expression());\n+\tsetMzExpression(get_Mz_expression());\n+\tsetFxExpression(get_Fx_expression());\n+\tsetFyExpression(get_Fy_expression());\n+\tsetFzExpression(get_Fz_expression());\n \n-    string errorMessage;\n-    const string& body1Name = get_body_1(); // error if unspecified\n-    const string& body2Name = get_body_2();\n+\tstring errorMessage;\n+\tconst string& body1Name = get_body_1(); // error if unspecified\n+\tconst string& body2Name = get_body_2();\n \n \n-    // Look up the two bodies being connected by bushing by name in the\n-    // model. TODO: keep a pointer to them?\n-    if (aModel.updBodySet().contains(body1Name)) {\n+\t// Look up the two bodies being connected by bushing by name in the\n+\t// model. TODO: keep a pointer to them?\n+\tif (aModel.updBodySet().contains(body1Name)) {\n         // ?Keep a pointer to body1?\n     }\n     else {\n-        errorMessage = "Invalid bushing body1 (" + body1Name \n+\t\terrorMessage = "Invalid bushing body1 (" + body1Name \n                         + ") specified in Force " + getName();\n-        throw OpenSim::Exception(errorMessage);\n-    }\n+\t\tthrow OpenSim::Exception(errorMessage);\n+\t}\n \n-    if (aModel.updBodySet().contains(body2Name)) {\n+\tif (aModel.updBodySet().contains(body2Name)) {\n         // ?Keep a pointer to body2?\n     }\n     else {\n-        errorMessage = "Invalid bushing body2 (" + body2Name \n+\t\terrorMessage = "Invalid bushing body2 (" + body2Name \n                         + ") specified in Force " + getName();\n-        throw OpenSim::Exception(errorMessage);\n-    }\n+\t\tthrow OpenSim::Exception(errorMessage);\n+\t}\n }\n \n void ExpressionBasedBushingForce::extendAddToSystem(SimTK::MultibodySystem& system) const\n {\n     Super::extendAddToSystem(system);\n \n-    const string&      body1Name            = get_body_1();\n-    const string&      body2Name            = get_body_2();\n-    const SimTK::Vec3& locationInBody1      = get_location_body_1();\n-    const SimTK::Vec3& orientationInBody1   = get_orientation_body_1();\n-    const SimTK::Vec3& locationInBody2      = get_location_body_2();\n-    const SimTK::Vec3& orientationInBody2   = get_orientation_body_2();\n+\tconst string&      body1Name            = get_body_1();\n+\tconst string&      body2Name            = get_body_2();\n+\tconst SimTK::Vec3& locationInBody1      = get_location_body_1();\n+\tconst SimTK::Vec3& orientationInBody1   = get_orientation_body_1();\n+\tconst SimTK::Vec3& locationInBody2      = get_location_body_2();\n+\tconst SimTK::Vec3& orientationInBody2   = get_orientation_body_2();\n \n-    Body& body1 = _model->updBodySet().get(body1Name);\n-    Body& body2 = _model->updBodySet().get(body2Name);\n+\tBody& body1 = _model->updBodySet().get(body1Name);\n+\tBody& body2 = _model->updBodySet().get(body2Name);\n \n     // Beyond the const Component get access to underlying SimTK elements\n-    ExpressionBasedBushingForce* mutableThis = const_cast<ExpressionBasedBushingForce *>(this);\n+\tExpressionBasedBushingForce* mutableThis = const_cast<ExpressionBasedBushingForce *>(this);\n \n     // Get underlying mobilized bodies\n     mutableThis->_b1 = &body1.getMobilizedBody();\n     mutableThis->_b2 = &body2.getMobilizedBody();\n-    // Define the transforms for the bushing frames affixed to the specified bodies\n-    SimTK::Rotation r1; r1.setRotationToBodyFixedXYZ(orientationInBody1);\n-    SimTK::Rotation r2; r2.setRotationToBodyFixedXYZ(orientationInBody2);\n-    // Hang on to the transforms for the bushing frames\n-    mutableThis->_inb1 = SimTK::Transform(r1, locationInBody1);\n-    mutableThis->_inb2 = SimTK::Transform(r2, locationInBody2);\n+\t// Define the transforms for the bushing frames affixed to the specified bodies\n+\tSimTK::Rotation r1; r1.setRotationToBodyFixedXYZ(orientationInBody1);\n+\tSimTK::Rotation r2; r2.setRotationToBodyFixedXYZ(orientationInBody2);\n+\t// Hang on to the transforms for the bushing frames\n+\tmutableThis->_inb1 = SimTK::Transform(r1, locationInBody1);\n+\tmutableThis->_inb2 = SimTK::Transform(r2, locationInBody2);\n }\n \n //=============================================================================\n@@ -238,111 +238,111 @@ void ExpressionBasedBushingForce::extendAddToSystem(SimTK::MultibodySystem& syst\n // The following methods set properties of the bushing Force.\n void ExpressionBasedBushingForce::setBody1ByName(const std::string& aBodyName)\n {\n-    set_body_1(aBodyName);\n+\tset_body_1(aBodyName);\n }\n \n void ExpressionBasedBushingForce::setBody2ByName(const std::string& aBodyName)\n {\n-    set_body_2(aBodyName);\n+\tset_body_2(aBodyName);\n }\n \n /** Set the location and orientation (optional) for weld on body 1*/\n void ExpressionBasedBushingForce::setBody1BushingLocation(const Vec3& location, \n                                            const Vec3& orientation)\n {\n-    set_location_body_1(location);\n-    set_orientation_body_1(orientation);\n+\tset_location_body_1(location);\n+\tset_orientation_body_1(orientation);\n }\n \n /** Set the location and orientation (optional) for weld on body 2*/\n void ExpressionBasedBushingForce::setBody2BushingLocation(const Vec3& location, \n                                            const Vec3& orientation)\n {\n-    set_location_body_2(location);\n-    set_orientation_body_2(orientation);\n+\tset_location_body_2(location);\n+\tset_orientation_body_2(orientation);\n }\n \n /** Set the expression for the Mx function and create it\'s lepton program */\n void ExpressionBasedBushingForce::setMxExpression(std::string expression) \n {\n-    expression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n-                        expression.end() );\n-    set_Mx_expression(expression);\n-    MxProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\texpression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t\texpression.end() );\n+\tset_Mx_expression(expression);\n+\tMxProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n \n /** Set the expression for the My function and create it\'s lepton program */\n void ExpressionBasedBushingForce::setMyExpression(std::string expression) \n {\n-    \n-    expression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n-                        expression.end() );\n-    set_My_expression(expression);\n-    MyProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\t\n+\texpression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t\texpression.end() );\n+\tset_My_expression(expression);\n+\tMyProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n \n /** Set the expression for the Mz function and create it\'s lepton program */\n void ExpressionBasedBushingForce::setMzExpression(std::string expression) \n {\n-    expression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n-                        expression.end() );\n-    set_Mz_expression(expression);\n-    MzProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\texpression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t\texpression.end() );\n+\tset_Mz_expression(expression);\n+\tMzProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n \n /** Set the expression for the Fx function and create it\'s lepton program */\n void ExpressionBasedBushingForce::setFxExpression(std::string expression) \n {\n-    expression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n-                        expression.end() );\n-    set_Fx_expression(expression);\n-    FxProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\texpression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t\texpression.end() );\n+\tset_Fx_expression(expression);\n+\tFxProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n \n /** Set the expression for the Fy function and create it\'s lepton program */\n void ExpressionBasedBushingForce::setFyExpression(std::string expression) \n {\n-    expression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n-                        expression.end() );\n-    set_Fy_expression(expression);\n-    FyProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\texpression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t\texpression.end() );\n+\tset_Fy_expression(expression);\n+\tFyProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n \n /** Set the expression for the Fz function and create it\'s lepton program */\n void ExpressionBasedBushingForce::setFzExpression(std::string expression) \n {\n-    expression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n-                        expression.end() );\n-    set_Fz_expression(expression);\n-    FzProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\texpression.erase( remove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t\texpression.end() );\n+\tset_Fz_expression(expression);\n+\tFzProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n //=============================================================================\n // COMPUTATION\n //=============================================================================\n /** Compute the deflection (spatial separation) of the two frames connected\n-    by the bushing force. Angualar displacement expressed in Euler angles.\n-    The force and potential energy are determined by the deflection.  */\n+\tby the bushing force. Angualar displacement expressed in Euler angles.\n+\tThe force and potential energy are determined by the deflection.  */\n SimTK::Vec6 ExpressionBasedBushingForce::computeDeflection(const SimTK::State& s) const\n {\n-    const Transform& X_GB1 = _b1->getBodyTransform(s);\n+\tconst Transform& X_GB1 = _b1->getBodyTransform(s);\n \n     const Transform& X_GB2 = _b2->getBodyTransform(s);\n \n-    // Define the frame on body 1 is the "fixed" frame, F\n-    Transform X_GF = X_GB1 * _inb1;\n-    // Define the frame on body 2 as the "moving" frame, M\n+\t// Define the frame on body 1 is the "fixed" frame, F\n+\tTransform X_GF = X_GB1 * _inb1;\n+\t// Define the frame on body 2 as the "moving" frame, M\n     Transform X_GM = X_GB2 * _inb2;\n-    // Express M in F\n+\t// Express M in F\n     Transform X_FM = ~X_GF * X_GM;    \n \n-    // the deviation of the two frames measured by dq\n+\t// the deviation of the two frames measured by dq\n     Vec6 dq(0);\n-    // First 3 are rotational deviations\n-    dq.updSubVec<3>(0) = X_FM.R().convertRotationToBodyFixedXYZ();\n-    // Second 3 are translational\n-    dq.updSubVec<3>(3) = X_FM.p();\n+\t// First 3 are rotational deviations\n+\tdq.updSubVec<3>(0) = X_FM.R().convertRotationToBodyFixedXYZ();\n+\t// Second 3 are translational\n+\tdq.updSubVec<3>(3) = X_FM.p();\n \n-    return dq;\n+\treturn dq;\n }\n \n /** compute the bushing force at the bushing location\n@@ -353,42 +353,42 @@ void ExpressionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& sta\n     const Transform& X_GB1 = _b1->getBodyTransform(state);\n     const Transform& X_GB2 = _b2->getBodyTransform(state);\n \n-    Transform X_GF = X_GB1 * _inb1;   \n+\tTransform X_GF = X_GB1 * _inb1;   \n     Transform X_GM = X_GB2 * _inb2;   \n     Transform X_FM = ~X_GF * X_GM;    \n-    const Rotation& R_GF = X_GF.R();\n-    const Rotation& R_GM = X_GM.R();\n-    const Rotation& R_FM = X_FM.R();\n+\tconst Rotation& R_GF = X_GF.R();\n+\tconst Rotation& R_GM = X_GM.R();\n+\tconst Rotation& R_FM = X_FM.R();\n \n     // Calculate stiffness generalized forces of bushing by first computing\n-    // the deviation of the two frames measured by dq\n+\t// the deviation of the two frames measured by dq\n     Vec6 dq = computeDeflection(state);\n \n     // TO DO: compute the deflection forces from functions\n     //------------------------------------------\n     Vec6 fk = Vec6(0.0);\n \n-    std::map<std::string, double> deflectionVars;\n-    deflectionVars["theta_x"] = dq[0];\n-    deflectionVars["theta_y"] = dq[1];\n-    deflectionVars["theta_z"] = dq[2];\n-    deflectionVars["delta_x"] = dq[3];\n-    deflectionVars["delta_y"] = dq[4];\n-    deflectionVars["delta_z"] = dq[5];\n-\n-    \n-    fk[0] = MxProg.evaluate(deflectionVars);\n-    fk[1] = MyProg.evaluate(deflectionVars);\n-    fk[2] = MzProg.evaluate(deflectionVars);\n-    fk[3] = FxProg.evaluate(deflectionVars);\n-    fk[4] = FyProg.evaluate(deflectionVars);\n-    fk[5] = FzProg.evaluate(deflectionVars);\n+\tstd::map<std::string, double> deflectionVars;\n+\tdeflectionVars["theta_x"] = dq[0];\n+\tdeflectionVars["theta_y"] = dq[1];\n+\tdeflectionVars["theta_z"] = dq[2];\n+\tdeflectionVars["delta_x"] = dq[3];\n+\tdeflectionVars["delta_y"] = dq[4];\n+\tdeflectionVars["delta_z"] = dq[5];\n+\n+\t\n+\tfk[0] = MxProg.evaluate(deflectionVars);\n+\tfk[1] = MyProg.evaluate(deflectionVars);\n+\tfk[2] = MzProg.evaluate(deflectionVars);\n+\tfk[3] = FxProg.evaluate(deflectionVars);\n+\tfk[4] = FyProg.evaluate(deflectionVars);\n+\tfk[5] = FzProg.evaluate(deflectionVars);\n \n     // Now evaluate velocities.\n     const SpatialVec& V_GB1 = _b1->getBodyVelocity(state);\n     const SpatialVec& V_GB2 = _b2->getBodyVelocity(state);\n \n-    // Re-express local vectors in the Ground frame.\n+\t// Re-express local vectors in the Ground frame.\n     Vec3 p_B1F_G =  X_GB1.R() * _inb1.p();   // 15 flops\n     Vec3 p_B2M_G =  X_GB2.R() * _inb2.p();   // 15 flops\n     Vec3 p_FM_G  =  X_GF.R()  * X_FM.p();    // 15 flops\n@@ -412,7 +412,7 @@ void ExpressionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& sta\n     // Need angular velocity in M frame for conversion to qdot.\n     const Vec3  w_FM_M = ~R_FM * V_FM[0];\n     const Mat33 N_FM   = Rotation::calcNForBodyXYZInBodyFrame(dq.getSubVec<3>(0));\n-    Vec6 dqdot(0);\n+\tVec6 dqdot(0);\n     dqdot.updSubVec<3>(0) = N_FM * w_FM_M;\n     dqdot.updSubVec<3>(3) = V_FM[1];\n \n@@ -425,12 +425,12 @@ void ExpressionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& sta\n         _dampingMatrix[i][i] = get_rotational_damping(0)[i];\n         _dampingMatrix[i+3][i+3] = get_translational_damping(0)[i];\n     }\n-    \n-    // velocity dependent force according to the speed of frame2 on \n-    // body2 relative to frame1 \n-    Vec6 fv = _dampingMatrix * dqdot;\n+\t\n+\t// velocity dependent force according to the speed of frame2 on \n+\t// body2 relative to frame1 \n+\tVec6 fv = _dampingMatrix * dqdot;\n \n-    Vec6 f = -(fk+fv); // generalized forces on body 2\n+\tVec6 f = -(fk+fv); // generalized forces on body 2\n     const Vec3& fB2_q = f.getSubVec<3>(0); // in q basis\n     const Vec3& fM_F  = f.getSubVec<3>(3); // acts at M, but exp. in F frame\n \n@@ -464,8 +464,8 @@ void ExpressionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& sta\n  * developed and implemented by Michael Sherman.\n  */\n void ExpressionBasedBushingForce::computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const\n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const\n {\n     \n     \n@@ -479,12 +479,12 @@ void ExpressionBasedBushingForce::computeForce(const SimTK::State& s,\n     const Transform& X_GB1 = _b1->getBodyTransform(s);\n     const Transform& X_GB2 = _b2->getBodyTransform(s);\n \n-    Transform X_GF = X_GB1 * _inb1;   \n+\tTransform X_GF = X_GB1 * _inb1;   \n     Transform X_GM = X_GB2 * _inb2;   \n     Transform X_FM = ~X_GF * X_GM;    \n-    const Rotation& R_GF = X_GF.R();\n-    const Rotation& R_GM = X_GM.R();\n-    const Rotation& R_FM = X_FM.R();\n+\tconst Rotation& R_GF = X_GF.R();\n+\tconst Rotation& R_GM = X_GM.R();\n+\tconst Rotation& R_FM = X_FM.R();\n \n     // Re-express local vectors in the Ground frame.\n     Vec3 p_B1F_G =  X_GB1.R() * _inb1.p();   // 15 flops\n@@ -495,8 +495,8 @@ void ExpressionBasedBushingForce::computeForce(const SimTK::State& s,\n     SpatialVec F_GB2(F_GM[0] + p_B2M_G % F_GM[1], F_GM[1]);\n     SpatialVec F_GB1(F_GF[0] + p_B1F_G % F_GF[1], F_GF[1]);\n \n-    // Apply (add-in) the body forces to the system set of body forces\n-    bodyForces[_b2->getMobilizedBodyIndex()] += F_GB2;\n+\t// Apply (add-in) the body forces to the system set of body forces\n+\tbodyForces[_b2->getMobilizedBodyIndex()] += F_GB2;\n     bodyForces[_b1->getMobilizedBodyIndex()] += F_GB1;\n }\n \n@@ -505,10 +505,10 @@ void ExpressionBasedBushingForce::computeForce(const SimTK::State& s,\n /**\n double CoupledBushingForce::computePotentialEnergy(const SimTK::State& s) const\n {\n-    Vec6 dq = computeDeflection(s);\n-    // Energy stored in the bushing\n-    double U = 0.5*(~dq*_stiffnessMatrix*dq);\n-    return U;\n+\tVec6 dq = computeDeflection(s);\n+\t// Energy stored in the bushing\n+\tdouble U = 0.5*(~dq*_stiffnessMatrix*dq);\n+\treturn U;\n }\n */\n \n@@ -521,24 +521,24 @@ double CoupledBushingForce::computePotentialEnergy(const SimTK::State& s) const\n  */\n OpenSim::Array<std::string> ExpressionBasedBushingForce::getRecordLabels() const \n {\n-    const string& body1Name = get_body_1();\n-    const string& body2Name = get_body_2();\n-\n-    OpenSim::Array<std::string> labels("");\n-    labels.append(getName()+"."+body1Name+".force.X");\n-    labels.append(getName()+"."+body1Name+".force.Y");\n-    labels.append(getName()+"."+body1Name+".force.Z");\n-    labels.append(getName()+"."+body1Name+".torque.X");\n-    labels.append(getName()+"."+body1Name+".torque.Y");\n-    labels.append(getName()+"."+body1Name+".torque.Z");\n-    labels.append(getName()+"."+body2Name+".force.X");\n-    labels.append(getName()+"."+body2Name+".force.Y");\n-    labels.append(getName()+"."+body2Name+".force.Z");\n-    labels.append(getName()+"."+body2Name+".torque.X");\n-    labels.append(getName()+"."+body2Name+".torque.Y");\n-    labels.append(getName()+"."+body2Name+".torque.Z");\n-\n-    return labels;\n+\tconst string& body1Name = get_body_1();\n+\tconst string& body2Name = get_body_2();\n+\n+\tOpenSim::Array<std::string> labels("");\n+\tlabels.append(getName()+"."+body1Name+".force.X");\n+\tlabels.append(getName()+"."+body1Name+".force.Y");\n+\tlabels.append(getName()+"."+body1Name+".force.Z");\n+\tlabels.append(getName()+"."+body1Name+".torque.X");\n+\tlabels.append(getName()+"."+body1Name+".torque.Y");\n+\tlabels.append(getName()+"."+body1Name+".torque.Z");\n+\tlabels.append(getName()+"."+body2Name+".force.X");\n+\tlabels.append(getName()+"."+body2Name+".force.Y");\n+\tlabels.append(getName()+"."+body2Name+".force.Z");\n+\tlabels.append(getName()+"."+body2Name+".torque.X");\n+\tlabels.append(getName()+"."+body2Name+".torque.Y");\n+\tlabels.append(getName()+"."+body2Name+".torque.Z");\n+\n+\treturn labels;\n }\n /**\n  * Provide the value(s) to be reported that correspond to the labels\n@@ -554,79 +554,77 @@ getRecordValues(const SimTK::State& state) const\n     OpenSim::Array<double> values(1);\n \n     values.append(3, &F_GF[1][0]);\n-    values.append(3, &F_GF[0][0]);\n+\tvalues.append(3, &F_GF[0][0]);\n     values.append(3, &F_GM[1][0]);\n-    values.append(3, &F_GM[0][0]);\n+\tvalues.append(3, &F_GM[0][0]);\n \n \n     /*  Old stuff reporting body forces at body origin\n     -----------------------------------------------------\n-    const string& body1Name = get_body_1();\n-    const string& body2Name = get_body_2();\n+\tconst string& body1Name = get_body_1();\n+\tconst string& body2Name = get_body_2();\n \n-    OpenSim::Array<double> values(1);\n+\tOpenSim::Array<double> values(1);\n \n-    const SimTK::Force::LinearBushing &simtkSpring = \n+\tconst SimTK::Force::LinearBushing &simtkSpring = \n         (SimTK::Force::LinearBushing &)(_model->getForceSubsystem().getForce(_index));\n \n-    SimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n-    SimTK::Vector_<SimTK::Vec3> particleForces(0);\n-    SimTK::Vector mobilityForces(0);\n+\tSimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n+\tSimTK::Vector_<SimTK::Vec3> particleForces(0);\n+\tSimTK::Vector mobilityForces(0);\n \n-    //get the net force added to the system contributed by the bushing\n-    simtkSpring.calcForceContribution(state, bodyForces, particleForces, mobilityForces);\n-    SimTK::Vec3 forces = bodyForces(_model->getBodySet().get(body1Name).getIndex())[1];\n-    SimTK::Vec3 torques = bodyForces(_model->getBodySet().get(body1Name).getIndex())[0];\n-    values.append(3, &forces[0]);\n-    values.append(3, &torques[0]);\n+\t//get the net force added to the system contributed by the bushing\n+\tsimtkSpring.calcForceContribution(state, bodyForces, particleForces, mobilityForces);\n+\tSimTK::Vec3 forces = bodyForces(_model->getBodySet().get(body1Name).getIndex())[1];\n+\tSimTK::Vec3 torques = bodyForces(_model->getBodySet().get(body1Name).getIndex())[0];\n+\tvalues.append(3, &forces[0]);\n+\tvalues.append(3, &torques[0]);\n \n-    forces = bodyForces(_model->getBodySet().get(body2Name).getIndex())[1];\n-    torques = bodyForces(_model->getBodySet().get(body2Name).getIndex())[0];\n+\tforces = bodyForces(_model->getBodySet().get(body2Name).getIndex())[1];\n+\ttorques = bodyForces(_model->getBodySet().get(body2Name).getIndex())[0];\n \n-    values.append(3, &forces[0]);\n-    values.append(3, &torques[0]);\n+\tvalues.append(3, &forces[0]);\n+\tvalues.append(3, &torques[0]);\n \n     */\n \n-    return values;\n+\treturn values;\n }\n \n //_____________________________________________________________________________\n /**\n  * Get the visible object used to represent the spring.\n  */\n-VisibleObject* ExpressionBasedBushingForce::getDisplayer() const\n-{ \n-    return const_cast<VisibleObject*>(&_displayer); \n-}\n \n void ExpressionBasedBushingForce::updateDisplayer(const SimTK::State& s)\n {\n-    SimTK::Vec3 globalLocation1, globalLocation2;\n-    const OpenSim::Body& body1 = _model->getBodySet().get(get_body_1());\n-    const OpenSim::Body& body2 = _model->getBodySet().get(get_body_2());\n-    _model->getSimbodyEngine().transformPosition(s, body1, get_location_body_1(), \n+\tSimTK::Vec3 globalLocation1, globalLocation2;\n+\tconst OpenSim::Body& body1 = _model->getBodySet().get(get_body_1());\n+\tconst OpenSim::Body& body2 = _model->getBodySet().get(get_body_2());\n+\t_model->getSimbodyEngine().transformPosition(s, body1, get_location_body_1(), \n                                                  globalLocation1);\n-    _model->getSimbodyEngine().transformPosition(s, body2, get_location_body_2(),\n+\t_model->getSimbodyEngine().transformPosition(s, body2, get_location_body_2(),\n                                                  globalLocation2);\n-\n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    ((LineGeometry *)_displayer.getGeometry(0))->\n+    /*\n+\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t}\n+\t((LineGeometry *)_displayer.getGeometry(0))->\n         setPoints(globalLocation1, globalLocation2);\n+        */\n }\n \n void ExpressionBasedBushingForce::updateGeometry(const SimTK::State& s)\n {\n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    updateDisplayer(s);\n+    /*\n+\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t} */\n+\tupdateDisplayer(s);\n }\n \n void ExpressionBasedBushingForce::generateDecorations\ndiff --git a/OpenSim/Simulation/Model/ExpressionBasedBushingForce.h b/OpenSim/Simulation/Model/ExpressionBasedBushingForce.h\nindex 5cda53e37..6ac25d26f 100644\n--- a/OpenSim/Simulation/Model/ExpressionBasedBushingForce.h\n+++ b/OpenSim/Simulation/Model/ExpressionBasedBushingForce.h\n@@ -65,36 +65,36 @@ public:\n     /** @name Property declarations\n     These are the serializable properties associated with this class. **/\n     /**@{**/\n-    OpenSim_DECLARE_OPTIONAL_PROPERTY(body_1, std::string,\n-        "One of the two bodies connected by the bushing.");\n-    OpenSim_DECLARE_OPTIONAL_PROPERTY(body_2, std::string,\n-        "The other of the two bodies connected by the bushing.");\n-    OpenSim_DECLARE_PROPERTY(location_body_1, SimTK::Vec3,\n-        "Location of bushing frame on body 1.");\n-    OpenSim_DECLARE_PROPERTY(orientation_body_1, SimTK::Vec3,\n-        "Orientation of bushing frame in body 1 as x-y-z, body fixed Euler rotations.");\n-    OpenSim_DECLARE_PROPERTY(location_body_2, SimTK::Vec3,\n-        "Location of bushing frame on body 2.");\n-    OpenSim_DECLARE_PROPERTY(orientation_body_2, SimTK::Vec3,\n-        "Orientation of bushing frame in body 2 as x-y-z, body fixed Euler rotations.");\n+\tOpenSim_DECLARE_OPTIONAL_PROPERTY(body_1, std::string,\n+\t\t"One of the two bodies connected by the bushing.");\n+\tOpenSim_DECLARE_OPTIONAL_PROPERTY(body_2, std::string,\n+\t\t"The other of the two bodies connected by the bushing.");\n+\tOpenSim_DECLARE_PROPERTY(location_body_1, SimTK::Vec3,\n+\t\t"Location of bushing frame on body 1.");\n+\tOpenSim_DECLARE_PROPERTY(orientation_body_1, SimTK::Vec3,\n+\t\t"Orientation of bushing frame in body 1 as x-y-z, body fixed Euler rotations.");\n+\tOpenSim_DECLARE_PROPERTY(location_body_2, SimTK::Vec3,\n+\t\t"Location of bushing frame on body 2.");\n+\tOpenSim_DECLARE_PROPERTY(orientation_body_2, SimTK::Vec3,\n+\t\t"Orientation of bushing frame in body 2 as x-y-z, body fixed Euler rotations.");\n     OpenSim_DECLARE_PROPERTY(Mx_expression, std::string,\n         "Expression defining the contribution of theta_x deflection to the moment about body_2\'s x axis."\n-        "The expression is a string and can not have any whitespace separating characters.");\n+\t\t"The expression is a string and can not have any whitespace separating characters.");\n     OpenSim_DECLARE_PROPERTY(My_expression, std::string,\n         "Expression defining the contribution of theta_y deflection to the moment about body_2\'s y axis."\n-        "The expression is a string and can not have any whitespace separating characters.");\n+\t\t"The expression is a string and can not have any whitespace separating characters.");\n     OpenSim_DECLARE_PROPERTY(Mz_expression, std::string,\n         "Expression defining the contribution of theta_z deflection to the moment about body_2\'s z axis."\n-        "The expression is a string and can not have any whitespace separating characters.");\n+\t\t"The expression is a string and can not have any whitespace separating characters.");\n     OpenSim_DECLARE_PROPERTY(Fx_expression, std::string,\n         "Expression defining the contribution of x deflection to the force in the x direction."\n-        "The expression is a string and can not have any whitespace separating characters.");\n+\t\t"The expression is a string and can not have any whitespace separating characters.");\n     OpenSim_DECLARE_PROPERTY(Fy_expression, std::string,\n         "Expression defining the contribution of y deflection to the force in the y direction."\n-        "The expression is a string and can not have any whitespace separating characters.");\n+\t\t"The expression is a string and can not have any whitespace separating characters.");\n     OpenSim_DECLARE_PROPERTY(Fz_expression, std::string,\n         "Expression defining the contribution of z deflection to the force in the z direction."\n-        "The expression is a string and can not have any whitespace separating characters.");\n+\t\t"The expression is a string and can not have any whitespace separating characters.");\n     OpenSim_DECLARE_OPTIONAL_PROPERTY(visual_aspect_ratio, double,\n         "Scalar number signifying the ratio of length/diameter used to display the force and "\n         "moment vectors.");\n@@ -105,58 +105,57 @@ public:\n     // To do:  Delete these stiffness properties\n     //--------------------------------------------------------\n     /*\n-    OpenSim_DECLARE_PROPERTY(rotational_stiffness, SimTK::Vec3,\n-        "Stiffness parameters resisting relative rotation.");\n-    OpenSim_DECLARE_PROPERTY(translational_stiffness, SimTK::Vec3,\n-        "Stiffness parameters resisting relative translation.");\n+\tOpenSim_DECLARE_PROPERTY(rotational_stiffness, SimTK::Vec3,\n+\t\t"Stiffness parameters resisting relative rotation.");\n+\tOpenSim_DECLARE_PROPERTY(translational_stiffness, SimTK::Vec3,\n+\t\t"Stiffness parameters resisting relative translation.");\n     */\n     //-------------------------------------------------------\n-    OpenSim_DECLARE_PROPERTY(rotational_damping, SimTK::Vec3,\n-        "Damping parameters resisting relative angular velocity.");\n-    OpenSim_DECLARE_PROPERTY(translational_damping, SimTK::Vec3,\n-        "Damping parameters resisting relative translational velocity.");\n+\tOpenSim_DECLARE_PROPERTY(rotational_damping, SimTK::Vec3,\n+\t\t"Damping parameters resisting relative angular velocity.");\n+\tOpenSim_DECLARE_PROPERTY(translational_damping, SimTK::Vec3,\n+\t\t"Damping parameters resisting relative translational velocity.");\n     /**@}**/\n \n protected:\n     /** how to display the bushing */\n-    VisibleObject _displayer;\n private:\n-    // parser programs for efficiently evaluating the expressions\n-    Lepton::ExpressionProgram MxProg, MyProg, MzProg, FxProg, FyProg, FzProg; \n-    // underlying SimTK system elements\n-    // the mobilized bodies involved\n-    const SimTK::MobilizedBody *_b1;\n-    const SimTK::MobilizedBody *_b2;\n-    // The bushing frames affixed to the mobilized bodies\n-    SimTK::Transform _inb1;\n-    SimTK::Transform _inb2;\n+\t// parser programs for efficiently evaluating the expressions\n+\tLepton::ExpressionProgram MxProg, MyProg, MzProg, FxProg, FyProg, FzProg; \n+\t// underlying SimTK system elements\n+\t// the mobilized bodies involved\n+\tconst SimTK::MobilizedBody *_b1;\n+\tconst SimTK::MobilizedBody *_b2;\n+\t// The bushing frames affixed to the mobilized bodies\n+\tSimTK::Transform _inb1;\n+\tSimTK::Transform _inb2;\n     \n \n public:\n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    /** Default constructor leaves bodies unspecified, sets the bushing frames\n+\t/** Default constructor leaves bodies unspecified, sets the bushing frames\n       * to be at their body origins, and sets all bushing parameters to zero. **/\n-    ExpressionBasedBushingForce();\n+\tExpressionBasedBushingForce();\n     /** This convenience constructor defines and sets the bushing frames on \n       * each body, and sets all bushing functions to zero.  **/\n     ExpressionBasedBushingForce(const std::string& body1Name, \n                  const SimTK::Vec3& point1, \n                  const SimTK::Vec3& orientation1,\n-                 const std::string& body2Name, \n+\t\t         const std::string& body2Name, \n                  const SimTK::Vec3& point2, \n                  const SimTK::Vec3& orientation2);\n     /** This convenience constructor defines a bushing that behaves like a\n       * primitive bushing.  Stiffnesses are used to define linear functions for\n       * force deflection profiles.**/\n-    ExpressionBasedBushingForce(const std::string& body1Name, \n+\tExpressionBasedBushingForce(const std::string& body1Name, \n                  const SimTK::Vec3& point1, \n                  const SimTK::Vec3& orientation1,\n-                 const std::string& body2Name, \n+\t\t         const std::string& body2Name, \n                  const SimTK::Vec3& point2, \n                  const SimTK::Vec3& orientation2,\n-                 const SimTK::Vec3& transStiffness, \n+\t\t\t\t const SimTK::Vec3& transStiffness, \n                  const SimTK::Vec3& rotStiffness, \n                  const SimTK::Vec3& transDamping, \n                  const SimTK::Vec3& rotDamping);\n@@ -164,17 +163,17 @@ public:\n     // Uses default (compiler-generated) destructor, copy constructor, and copy\n     // assignment operator.\n \n-    /** Set the name of the Body that will serve as body 1 for this bushing. **/\n-    void setBody1ByName(const std::string& aBodyName);\n+\t/** Set the name of the Body that will serve as body 1 for this bushing. **/\n+\tvoid setBody1ByName(const std::string& aBodyName);\n     /** Set the location and orientation (optional) for bushing frame on \n       * body 1. **/\n-    void setBody1BushingLocation(const SimTK::Vec3& location, \n+\tvoid setBody1BushingLocation(const SimTK::Vec3& location, \n                                  const SimTK::Vec3& orientation=SimTK::Vec3(0));\n-    /** Set the name of the Body that will serve as body 2 for this bushing. **/\n-    void setBody2ByName(const std::string& aBodyName);\n+\t/** Set the name of the Body that will serve as body 2 for this bushing. **/\n+\tvoid setBody2ByName(const std::string& aBodyName);\n     /** Set the location and orientation (optional) for bushing frame on \n       * body 2. **/\n-    void setBody2BushingLocation(const SimTK::Vec3& location, \n+\tvoid setBody2BushingLocation(const SimTK::Vec3& location, \n                                  const SimTK::Vec3& orientation=SimTK::Vec3(0));\n     /** Set the value used to scale the bushing moment on body2 when drawing it to screen.  \n       * A moment of magnitude |M| will be drawn on screen with a length of (|M|*scale).  **/\n@@ -185,73 +184,73 @@ public:\n     /** Set the aspect ratio used to control the thickness of the bushing force and moment\n       * in drawn in the visualizer.  ratio = length/diameter.**/\n     void setVisualAspectRatio(double ratio) {set_visual_aspect_ratio(ratio);}\n-    /** Set the expression defining Mx as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    void setMxExpression(std::string expression);\n-    /** Set the expression defining My as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    void setMyExpression(std::string expression);\n-    /** Set the expression defining Mz as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    void setMzExpression(std::string expression);\n-    /** Set the expression defining Fx as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    void setFxExpression(std::string expression);\n-    /** Set the expression defining Fy as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    void setFyExpression(std::string expression);\n-    /** Set the expression defining Fz as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    void setFzExpression(std::string expression);\n-    /** Get the expression defining Mx as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    std::string getMxExpression() { return get_Mx_expression(); }\n-    /** Get the expression defining My as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    std::string getMyExpression() { return get_My_expression(); }\n-    /** Get the expression defining Mz as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    std::string getMzExpression() { return get_Mz_expression(); }\n-    /** Get the expression defining Fx as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    std::string getFxExpression() { return get_Fx_expression(); }\n-    /** Get the expression defining Fy as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    std::string getFyExpression() { return get_Fy_expression(); }\n-    /** Get the expression defining Fz as a function of the bushing deflections theta_x, \n-      * theta_y, theta_z, delta_x, delta_y, delta_z **/\n-    std::string getFzExpression() { return get_Fz_expression(); }\n-    //--------------------------------------------------------------------------\n-    // COMPUTATION\n-    //--------------------------------------------------------------------------\n-    /** Compute the deflection (spatial separation) of the two frames connected\n-      * by the bushing force. Angualar displacement expressed in Euler angles.\n-      * The force and potential energy are determined by the deflection.  **/\n-    virtual SimTK::Vec6 computeDeflection(const SimTK::State& s) const;\n+\t/** Set the expression defining Mx as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tvoid setMxExpression(std::string expression);\n+\t/** Set the expression defining My as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tvoid setMyExpression(std::string expression);\n+\t/** Set the expression defining Mz as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tvoid setMzExpression(std::string expression);\n+\t/** Set the expression defining Fx as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tvoid setFxExpression(std::string expression);\n+\t/** Set the expression defining Fy as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tvoid setFyExpression(std::string expression);\n+\t/** Set the expression defining Fz as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tvoid setFzExpression(std::string expression);\n+\t/** Get the expression defining Mx as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tstd::string getMxExpression() { return get_Mx_expression(); }\n+\t/** Get the expression defining My as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tstd::string getMyExpression() { return get_My_expression(); }\n+\t/** Get the expression defining Mz as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tstd::string getMzExpression() { return get_Mz_expression(); }\n+\t/** Get the expression defining Fx as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tstd::string getFxExpression() { return get_Fx_expression(); }\n+\t/** Get the expression defining Fy as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tstd::string getFyExpression() { return get_Fy_expression(); }\n+\t/** Get the expression defining Fz as a function of the bushing deflections theta_x, \n+\t  * theta_y, theta_z, delta_x, delta_y, delta_z **/\n+\tstd::string getFzExpression() { return get_Fz_expression(); }\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATION\n+\t//--------------------------------------------------------------------------\n+\t/** Compute the deflection (spatial separation) of the two frames connected\n+\t  * by the bushing force. Angualar displacement expressed in Euler angles.\n+\t  * The force and potential energy are determined by the deflection.  **/\n+\tvirtual SimTK::Vec6 computeDeflection(const SimTK::State& s) const;\n \n-    /** Compute the bushing force contribution to the system and add in to appropriate\n-      * bodyForce and/or system generalizedForce. \n-      */\n-    virtual void computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const;\n+\t/** Compute the bushing force contribution to the system and add in to appropriate\n+\t  * bodyForce and/or system generalizedForce. \n+\t  */\n+\tvirtual void computeForce(const SimTK::State& s, \n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const;\n \n     /** Potential energy calculation is not implemented */\n \n     \n \n-    //--------------------------------------------------------------------------\n-    // Reporting\n-    //--------------------------------------------------------------------------\n-    /** \n-     * Provide name(s) of the quantities (column labels) of the force value(s) \n+\t//--------------------------------------------------------------------------\n+\t// Reporting\n+\t//--------------------------------------------------------------------------\n+\t/** \n+\t * Provide name(s) of the quantities (column labels) of the force value(s) \n      * to be reported.\n-     */\n-    virtual OpenSim::Array<std::string> getRecordLabels() const ;\n-    /**\n-    *  Provide the value(s) to be reported that correspond to the labels\n-    */\n-    virtual OpenSim::Array<double> getRecordValues(const SimTK::State& state) const ;\n+\t */\n+\tvirtual OpenSim::Array<std::string> getRecordLabels() const ;\n+\t/**\n+\t*  Provide the value(s) to be reported that correspond to the labels\n+\t*/\n+\tvirtual OpenSim::Array<double> getRecordValues(const SimTK::State& state) const ;\n \n protected:\n     //--------------------------------------------------------------------------\n@@ -263,28 +262,27 @@ protected:\n         const SimTK::State&                         state,\n         SimTK::Array_<SimTK::DecorativeGeometry>&   geometryArray) const;\n     \n-    void ComputeForcesAtBushing(const SimTK::State& state, \n+\tvoid ComputeForcesAtBushing(const SimTK::State& state, \n                                 SimTK::SpatialVec& forces_on_M_in_ground, \n                                 SimTK::SpatialVec& forces_on_F_in_ground) const;\n \n private:\n-    //--------------------------------------------------------------------------\n-    // Implement ModelComponent interface.\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// Implement ModelComponent interface.\n+\t//--------------------------------------------------------------------------\n     void extendConnectToModel(Model& aModel) override;\n-    // Create a SimTK::Force::LinarBushing which implements this ExpressionBasedBushingForce.\n+\t// Create a SimTK::Force::LinarBushing which implements this ExpressionBasedBushingForce.\n     void extendAddToSystem(SimTK::MultibodySystem& system) const override;\n     //--------------------------------------------------------------------------\n-    // Visible Object Support for Java Gui\n-    //--------------------------------------------------------------------------\n-    virtual VisibleObject* getDisplayer() const;\n-    virtual void updateDisplayer(const SimTK::State& s);\n-    virtual void updateGeometry(const SimTK::State& s);\n-    void setNull();\n-    void constructProperties();\n+\t// Visible Object Support for Java Gui\n+\t//--------------------------------------------------------------------------\n+\tvirtual void updateDisplayer(const SimTK::State& s);\n+\tvirtual void updateGeometry(const SimTK::State& s);\n+\tvoid setNull();\n+\tvoid constructProperties();\n \n //==============================================================================\n-};  // END of class ExpressionBasedBushingForce\n+};\t// END of class ExpressionBasedBushingForce\n //==============================================================================\n //==============================================================================\n \ndiff --git a/OpenSim/Simulation/Model/ExpressionBasedCoordinateForce.h b/OpenSim/Simulation/Model/ExpressionBasedCoordinateForce.h\nindex cf4072a3f..20c0f3f93 100644\n--- a/OpenSim/Simulation/Model/ExpressionBasedCoordinateForce.h\n+++ b/OpenSim/Simulation/Model/ExpressionBasedCoordinateForce.h\n@@ -24,7 +24,6 @@\n  * -------------------------------------------------------------------------- */\n // INCLUDE\n #include "Force.h"\n-#include <OpenSim/Common/VisibleObject.h>\n #include <Vendors/lepton/include/Lepton.h>\n \n namespace OpenSim {\ndiff --git a/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp b/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\nindex a37bb3973..2bf6d5a98 100644\n--- a/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\n+++ b/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\n@@ -45,33 +45,33 @@ using namespace std;\n //Default constructor.\n ExpressionBasedPointToPointForce::ExpressionBasedPointToPointForce()\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n }\n //_____________________________________________________________________________\n // Convenience constructor for API users.\n ExpressionBasedPointToPointForce::ExpressionBasedPointToPointForce(\n-                const string& body1Name, const SimTK::Vec3& point1, \n-                const string& body2Name, const SimTK::Vec3& point2, \n+\t\t\t\tconst string& body1Name, const SimTK::Vec3& point1, \n+\t\t        const string& body2Name, const SimTK::Vec3& point2, \n                 const string& expression)\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n \n     // Set properties to the passed-in values.\n-    setBody1Name(body1Name);\n-    setBody2Name(body2Name);\n+\tsetBody1Name(body1Name);\n+\tsetBody2Name(body2Name);\n \n-    setPoint1(point1);\n-    setPoint2(point2);\n+\tsetPoint1(point1);\n+\tsetPoint2(point2);\n \n-    setExpression(expression);\n+\tsetExpression(expression);\n }\n \n // Set the expression for the force function and create it\'s lepton program \n void ExpressionBasedPointToPointForce::setExpression(const string& expression) \n {\n-    set_expression(expression);\n+\tset_expression(expression);\n }\n \n //=============================================================================\n@@ -83,7 +83,7 @@ void ExpressionBasedPointToPointForce::setExpression(const string& expression)\n  */\n void ExpressionBasedPointToPointForce::setNull()\n {\n-    setAuthors("Ajay Seth"); \n+\tsetAuthors("Ajay Seth"); \n }\n \n \n@@ -93,14 +93,14 @@ void ExpressionBasedPointToPointForce::setNull()\n  */\n void ExpressionBasedPointToPointForce::constructProperties()\n {\n-    constructProperty_body1();\n-    constructProperty_body2();\n+\tconstructProperty_body1();\n+\tconstructProperty_body2();\n \n-    const SimTK::Vec3 bodyOrigin(0.0, 0.0, 0.0);\n-    constructProperty_point1(bodyOrigin);\n-    constructProperty_point2(bodyOrigin);\n+\tconst SimTK::Vec3 bodyOrigin(0.0, 0.0, 0.0);\n+\tconstructProperty_point1(bodyOrigin);\n+\tconstructProperty_point2(bodyOrigin);\n \n-    std::string zero = "0.0";\n+\tstd::string zero = "0.0";\n     constructProperty_expression( zero );\n }\n \n@@ -108,38 +108,33 @@ void ExpressionBasedPointToPointForce::constructProperties()\n /**\n  * Get the visible object used to represent the spring.\n  */\n-VisibleObject* ExpressionBasedPointToPointForce::getDisplayer() const\n-{ \n-    return const_cast<VisibleObject*>(&_displayer); \n-}\n-\n void ExpressionBasedPointToPointForce::updateDisplayer(const SimTK::State& s)\n {\n-    SimTK::Vec3 globalLocation1, globalLocation2;\n-    const OpenSim::Body& body1 = _model->getBodySet().get(getBody1Name());\n-    const OpenSim::Body& body2 = _model->getBodySet().get(getBody2Name());\n-    _model->getSimbodyEngine().transformPosition(s, body1, getPoint1(), \n+\tSimTK::Vec3 globalLocation1, globalLocation2;\n+\tconst OpenSim::Body& body1 = _model->getBodySet().get(getBody1Name());\n+\tconst OpenSim::Body& body2 = _model->getBodySet().get(getBody2Name());\n+\t_model->getSimbodyEngine().transformPosition(s, body1, getPoint1(), \n                                                  globalLocation1);\n-    _model->getSimbodyEngine().transformPosition(s, body2, getPoint2(),\n+\t_model->getSimbodyEngine().transformPosition(s, body2, getPoint2(),\n                                                  globalLocation2);\n \n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    ((LineGeometry *)_displayer.getGeometry(0))->\n-        setPoints(globalLocation1, globalLocation2);\n+/*\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t}\n+\t((LineGeometry *)_displayer.getGeometry(0))->\n+        setPoints(globalLocation1, globalLocation2);*/\n }\n \n void ExpressionBasedPointToPointForce::updateGeometry(const SimTK::State& s)\n {\n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    updateDisplayer(s);\n+/*\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t} */\n+\tupdateDisplayer(s);\n }\n \n //=============================================================================\n@@ -151,23 +146,23 @@ void ExpressionBasedPointToPointForce::extendConnectToModel(Model& model)\n \n     // Look up the two bodies being connected by bushing by name in the\n     // model. TODO: use Connectors\n-    const string& body1Name = getBody1Name();\n-    const string& body2Name = getBody2Name();\n+\tconst string& body1Name = getBody1Name();\n+\tconst string& body2Name = getBody2Name();\n \n     _body1 =\n         static_cast<const PhysicalFrame*>(&getModel().getComponent(body1Name));\n     _body2 =\n         static_cast<const PhysicalFrame*>(&getModel().getComponent(body2Name));\n \n-    if(getName() == "")\n-        setName("expressionP2PForce_"+body1Name+"To"+body2Name);\n+\tif(getName() == "")\n+\t\tsetName("expressionP2PForce_"+body1Name+"To"+body2Name);\n \n-    string& expression = upd_expression();\n-    expression.erase(\n-            remove_if(expression.begin(), expression.end(), ::isspace), \n-                      expression.end() );\n-    \n-    _forceProg = Lepton::Parser::parse(expression).optimize().createProgram();\n+\tstring& expression = upd_expression();\n+\texpression.erase(\n+\t\t\tremove_if(expression.begin(), expression.end(), ::isspace), \n+\t\t\t\t\t  expression.end() );\n+\t\n+\t_forceProg = Lepton::Parser::parse(expression).optimize().createProgram();\n }\n \n //=============================================================================\n@@ -178,13 +173,13 @@ extendAddToSystem(SimTK::MultibodySystem& system) const\n {\n     Super::extendAddToSystem(system);    // Base class first.\n \n-    addCacheVariable<double>("force_magnitude", 0.0, SimTK::Stage::Velocity);\n+\taddCacheVariable<double>("force_magnitude", 0.0, SimTK::Stage::Velocity);\n \n-    // Beyond the const Component get access to underlying SimTK elements\n-    ExpressionBasedPointToPointForce* mutableThis =\n-        const_cast<ExpressionBasedPointToPointForce *>(this);\n+\t// Beyond the const Component get access to underlying SimTK elements\n+\tExpressionBasedPointToPointForce* mutableThis =\n+\t\tconst_cast<ExpressionBasedPointToPointForce *>(this);\n \n-    // Get underlying mobilized bodies\n+\t// Get underlying mobilized bodies\n     mutableThis->_b1 = _body1->getMobilizedBody();\n     mutableThis->_b2 = _body2->getMobilizedBody();\n }\n@@ -194,10 +189,10 @@ extendAddToSystem(SimTK::MultibodySystem& system) const\n //=============================================================================\n // Compute and apply the force\n void ExpressionBasedPointToPointForce::computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const\n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const\n {\n-    using namespace SimTK;\n+\tusing namespace SimTK;\n \n     const Transform& X_GB1 = _b1->getBodyTransform(s);\n     const Transform& X_GB2 = _b2->getBodyTransform(s);\n@@ -207,32 +202,32 @@ void ExpressionBasedPointToPointForce::computeForce(const SimTK::State& s,\n \n     const Vec3 p1_G = X_GB1.p() + s1_G; // point measured from ground origin\n     const Vec3 p2_G = X_GB2.p() + s2_G;\n-    const Vec3 r_G = p2_G - p1_G; // vector from point1 to point2\n+\tconst Vec3 r_G = p2_G - p1_G; // vector from point1 to point2\n     const double d = r_G.norm();  // distance between the points\n \n-    const Vec3 v1_G = _b1->findStationVelocityInGround(s, getPoint1());\n+\tconst Vec3 v1_G = _b1->findStationVelocityInGround(s, getPoint1());\n     const Vec3 v2_G = _b2->findStationVelocityInGround(s, getPoint2());\n     const Vec3 vRel = v2_G - v1_G; // relative velocity\n \n-    //speed along the line connecting the two bodies\n-    const double ddot = dot(vRel, r_G)/d;\n+\t//speed along the line connecting the two bodies\n+\tconst double ddot = dot(vRel, r_G)/d;\n \n-    std::map<std::string, double> forceVars;\n-    forceVars["d"] = d;\n-    forceVars["ddot"] = ddot;\n+   \tstd::map<std::string, double> forceVars;\n+\tforceVars["d"] = d;\n+\tforceVars["ddot"] = ddot;\n \n-    double forceMag = _forceProg.evaluate(forceVars);\n+\tdouble forceMag = _forceProg.evaluate(forceVars);\n     setCacheVariableValue<double>(s, "force_magnitude", forceMag);\n \n-    const Vec3 f1_G = (forceMag/d) * r_G;\n+\tconst Vec3 f1_G = (forceMag/d) * r_G;\n \n-    bodyForces[_b1->getMobilizedBodyIndex()] +=  SpatialVec(s1_G % f1_G, f1_G);\n+\tbodyForces[_b1->getMobilizedBodyIndex()] +=  SpatialVec(s1_G % f1_G, f1_G);\n     bodyForces[_b2->getMobilizedBodyIndex()] -=  SpatialVec(s2_G % f1_G, f1_G);\n }\n \n // get the force magnitude that has already been computed\n const double& ExpressionBasedPointToPointForce::\n-    getForceMagnitude(const SimTK::State& s)\n+\tgetForceMagnitude(const SimTK::State& s)\n {\n     return getCacheVariableValue<double>(s, "force_magnitude");\n }\n@@ -245,54 +240,54 @@ const double& ExpressionBasedPointToPointForce::\n // reported.\n OpenSim::Array<std::string> ExpressionBasedPointToPointForce::getRecordLabels() const \n {\n-    const string& body1Name = getBody1Name();\n-    const string& body2Name = getBody2Name();\n-\n-    OpenSim::Array<std::string> labels("");\n-    labels.append(getName()+"."+body1Name+".force.X");\n-    labels.append(getName()+"."+body1Name+".force.Y");\n-    labels.append(getName()+"."+body1Name+".force.Z");\n-    labels.append(getName()+"."+body1Name+".point.X");\n-    labels.append(getName()+"."+body1Name+".point.Y");\n-    labels.append(getName()+"."+body1Name+".point.Z");\n-    labels.append(getName()+"."+body2Name+".force.X");\n-    labels.append(getName()+"."+body2Name+".force.Y");\n-    labels.append(getName()+"."+body2Name+".force.Z");\n-    labels.append(getName()+"."+body2Name+".point.X");\n-    labels.append(getName()+"."+body2Name+".point.Y");\n-    labels.append(getName()+"."+body2Name+".point.Z");\n-\n-    return labels;\n+\tconst string& body1Name = getBody1Name();\n+\tconst string& body2Name = getBody2Name();\n+\n+\tOpenSim::Array<std::string> labels("");\n+\tlabels.append(getName()+"."+body1Name+".force.X");\n+\tlabels.append(getName()+"."+body1Name+".force.Y");\n+\tlabels.append(getName()+"."+body1Name+".force.Z");\n+\tlabels.append(getName()+"."+body1Name+".point.X");\n+\tlabels.append(getName()+"."+body1Name+".point.Y");\n+\tlabels.append(getName()+"."+body1Name+".point.Z");\n+\tlabels.append(getName()+"."+body2Name+".force.X");\n+\tlabels.append(getName()+"."+body2Name+".force.Y");\n+\tlabels.append(getName()+"."+body2Name+".force.Z");\n+\tlabels.append(getName()+"."+body2Name+".point.X");\n+\tlabels.append(getName()+"."+body2Name+".point.Y");\n+\tlabels.append(getName()+"."+body2Name+".point.Z");\n+\n+\treturn labels;\n }\n \n // Provide the value(s) to be reported that correspond to the labels.\n OpenSim::Array<double> ExpressionBasedPointToPointForce::\n getRecordValues(const SimTK::State& state) const \n {\n-    OpenSim::Array<double> values(1);\n+\tOpenSim::Array<double> values(1);\n \n-    SimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n-    SimTK::Vector_<SimTK::Vec3> particleForces(0);\n-    SimTK::Vector mobilityForces(0);\n+\tSimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n+\tSimTK::Vector_<SimTK::Vec3> particleForces(0);\n+\tSimTK::Vector mobilityForces(0);\n \n \n-    //get the net force added to the system contributed by the Spring\n-    _model->getForceSubsystem().getForce(_index)\n-        .calcForceContribution(state, bodyForces, particleForces, mobilityForces);\n-    \n+\t//get the net force added to the system contributed by the Spring\n+\t_model->getForceSubsystem().getForce(_index)\n+\t\t.calcForceContribution(state, bodyForces, particleForces, mobilityForces);\n+\t\n     SimTK::Vec3 forces = bodyForces(_body1->getMobilizedBodyIndex())[1];\n-    values.append(3, &forces[0]);\n+\tvalues.append(3, &forces[0]);\n \n-    SimTK::Vec3 gpoint(0);\n+\tSimTK::Vec3 gpoint(0);\n     _model->getSimbodyEngine().getPosition(state, *_body1, getPoint1(), gpoint);\n-    values.append(3, &gpoint[0]);\n+\tvalues.append(3, &gpoint[0]);\n \n     forces = bodyForces(_body2->getMobilizedBodyIndex())[1];\n-    values.append(3, &forces[0]);\n+\tvalues.append(3, &forces[0]);\n \n     _model->getSimbodyEngine().getPosition(state, *_body2, getPoint2(), gpoint);\n-    values.append(3, &gpoint[0]);\n+\tvalues.append(3, &gpoint[0]);\n \n-    return values;\n+\treturn values;\n }\n \ndiff --git a/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h b/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\nindex 6c4e39bd7..fca7e826e 100644\n--- a/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\n+++ b/OpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\n@@ -24,7 +24,6 @@\n  * -------------------------------------------------------------------------- */\n \n #include "Force.h"\n-#include <OpenSim/Common/VisibleObject.h>\n #include <Vendors/lepton/include/Lepton.h>\n \n //==============================================================================\n@@ -42,9 +41,9 @@ namespace OpenSim {\n  * are permitted. See Lepton/Operation.h for a complete list.\n  * \n  * For example: string expression = "-1.5*exp(10*(d-0.25)^2)*(1 + 2.0*ddot)"\n- *              provides a model of a nonlinear point-to point spring, while \n- *              expression = "1.25/(rd^2)" is an electric field force between\n- *              charged particles at points separated by the distance, d.\n+ *\t\t\t\tprovides a model of a nonlinear point-to point spring, while \n+ *\t\t\t\texpression = "1.25/(rd^2)" is an electric field force between\n+ *\t\t\t\tcharged particles at points separated by the distance, d.\n  *              i.e. K*q1*q2 = 1.25\n  *\n  * @author Ajay Seth\n@@ -59,139 +58,135 @@ public:\n     These are the serializable properties associated with this class. **/\n     /**@{**/\n     OpenSim_DECLARE_OPTIONAL_PROPERTY(body1, std::string,\n-        "Name of the Body to which the 1st point of the force is attached.");\n-    OpenSim_DECLARE_OPTIONAL_PROPERTY(body2, std::string,\n-        "Name of the Body to which the 2nd point of the force is attached.");\n-    OpenSim_DECLARE_PROPERTY(point1, SimTK::Vec3,\n-        "Force application point on body1.");\n-    OpenSim_DECLARE_PROPERTY(point2, SimTK::Vec3,\n-        "Force application point on body2.");\n+\t\t"Name of the Body to which the 1st point of the force is attached.");\n+\tOpenSim_DECLARE_OPTIONAL_PROPERTY(body2, std::string,\n+\t\t"Name of the Body to which the 2nd point of the force is attached.");\n+\tOpenSim_DECLARE_PROPERTY(point1, SimTK::Vec3,\n+\t\t"Force application point on body1.");\n+\tOpenSim_DECLARE_PROPERTY(point2, SimTK::Vec3,\n+\t\t"Force application point on body2.");\n     OpenSim_DECLARE_PROPERTY(expression, std::string,\n-        "Expression of the point-to-point force magnitude as a function of "\n-        "the distance (d) between the points and its time derivative (ddot). "\n-        "Note, expression cannot have any whitespace separating characters.");\n+\t\t"Expression of the point-to-point force magnitude as a function of "\n+\t\t"the distance (d) between the points and its time derivative (ddot). "\n+\t\t"Note, expression cannot have any whitespace separating characters.");\n     /**@}**/\n \n \n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    /** Default constructor. **/\n-    ExpressionBasedPointToPointForce();\n+\t/** Default constructor. **/\n+\tExpressionBasedPointToPointForce();\n     /** Convenience constructor for API users.\n     @param body1Name    name of the first body to which the p2p force is attached\n     @param point1       first point location attached to body1\n     @param body2Name    name of the second body to which the p2p force is attached\n     @param point2       second  point location attached to body2\n-    @param expression   the expression used to compute the force action at points\n+\t@param expression\tthe expression used to compute the force action at points\n     **/\n-    ExpressionBasedPointToPointForce(\n-                const std::string& body1Name, const SimTK::Vec3& point1, \n-                const std::string& body2Name, const SimTK::Vec3& point2, \n+\tExpressionBasedPointToPointForce(\n+\t\t\t\tconst std::string& body1Name, const SimTK::Vec3& point1, \n+\t\t        const std::string& body2Name, const SimTK::Vec3& point2, \n                 const std::string& expression );\n \n     // default destructor, copy constructor, copy assignment\n-    \n-    //-----------------------------------------------------------------------------\n-    // GET and SET Spring parameters\n-    //-----------------------------------------------------------------------------\n-    /**\n-    * Force end point bodies \n-    */\n-    void setBody1Name(const std::string& body1Name) \n+\t\n+\t//-----------------------------------------------------------------------------\n+\t// GET and SET Spring parameters\n+\t//-----------------------------------------------------------------------------\n+\t/**\n+\t* Force end point bodies \n+\t*/\n+\tvoid setBody1Name(const std::string& body1Name) \n     {   set_body1(body1Name); }\n-    void setBody2Name(const std::string& body2Name) \n+\tvoid setBody2Name(const std::string& body2Name) \n     {   set_body2(body2Name); }\n-    const std::string& getBody1Name() const {return get_body1();}\n-    const std::string& getBody2Name() const {return get_body2();}\n-\n-    /**\n-    * Force end points \n-    */\n-    void setPoint1(SimTK::Vec3 aPosition) { set_point1(aPosition); }\n-    const SimTK::Vec3& getPoint1() const { return get_point1(); }\n-    void setPoint2(SimTK::Vec3 aPosition) { set_point2(aPosition); }\n-    const SimTK::Vec3& getPoint2() const { return get_point2(); }\n-\n-    /**\n-    * Set the mathematical expression that defines the force magnitude of this\n-    * point-to-point force in terms of the point-to-point distance (d) and its\n-    * time derivative (ddot). Expressions with C-mathematical operations\n-    * such as +,-,*,/ and common functions: exp, pow, sqrt, sin, cos, tan, \n-    * and so on are acceptable.\n-    * NOTE: a limitation is that the expression may not contain whitespace\n-    * @param expression    string containing the mathematical expression that\n-    *                      defines the point-to-point force \n-    */\n-    void setExpression(const std::string& expression);\n-\n-\n-    /** \n-    * Get the computed Force magnitude determined by evaluating the \n-    * expression above. Note, computeForce must be evaluated first,\n-    * and this is done automatically if the system is realized to Dynamics\n-    * @param state    const state (reference) for the model\n-    * @return         const double ref to the force magnitude\n-    */\n-    const double& getForceMagnitude(const SimTK::State& state);\n-\n-\n-    //--------------------------------------------------------------------------\n-    // COMPUTATION\n-    //--------------------------------------------------------------------------\n-    /** Compute the point-to-point force based on the user-defined expression \n-        and apply it to the model */\n-    void computeForce(const SimTK::State& state, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const override;\n-\n-\n-    //-----------------------------------------------------------------------------\n-    // Reporting\n-    //-----------------------------------------------------------------------------\n-    /** \n-     * Provide name(s) of the quantities (column labels) of the force value(s) to be reported\n-     */\n-    OpenSim::Array<std::string> getRecordLabels() const override;\n-    /**\n-    *  Provide the value(s) to be reported that correspond to the labels\n-    */\n-    OpenSim::Array<double> getRecordValues(const SimTK::State& state) const override;\n-\n-    //--------------------------------------------------------------------------\n-    // Visible Object Support\n-    //--------------------------------------------------------------------------\n-    VisibleObject* getDisplayer() const;\n-    void updateDisplayer(const SimTK::State& s);\n-    void updateGeometry(const SimTK::State& s);\n+\tconst std::string& getBody1Name() const {return get_body1();}\n+\tconst std::string& getBody2Name() const {return get_body2();}\n+\n+\t/**\n+\t* Force end points \n+\t*/\n+\tvoid setPoint1(SimTK::Vec3 aPosition) { set_point1(aPosition); }\n+\tconst SimTK::Vec3& getPoint1() const { return get_point1(); }\n+\tvoid setPoint2(SimTK::Vec3 aPosition) { set_point2(aPosition); }\n+\tconst SimTK::Vec3& getPoint2() const { return get_point2(); }\n+\n+\t/**\n+\t* Set the mathematical expression that defines the force magnitude of this\n+\t* point-to-point force in terms of the point-to-point distance (d) and its\n+\t* time derivative (ddot). Expressions with C-mathematical operations\n+\t* such as +,-,*,/ and common functions: exp, pow, sqrt, sin, cos, tan, \n+\t* and so on are acceptable.\n+\t* NOTE: a limitation is that the expression may not contain whitespace\n+\t* @param expression    string containing the mathematical expression that\n+\t*\t\t\t\t\t   defines the point-to-point force \n+\t*/\n+\tvoid setExpression(const std::string& expression);\n+\n+\n+\t/** \n+\t* Get the computed Force magnitude determined by evaluating the \n+\t* expression above. Note, computeForce must be evaluated first,\n+\t* and this is done automatically if the system is realized to Dynamics\n+\t* @param state    const state (reference) for the model\n+\t* @return         const double ref to the force magnitude\n+\t*/\n+\tconst double& getForceMagnitude(const SimTK::State& state);\n+\n+\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATION\n+\t//--------------------------------------------------------------------------\n+\t/** Compute the point-to-point force based on the user-defined expression \n+\t    and apply it to the model */\n+\tvoid computeForce(const SimTK::State& state, \n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const override;\n+\n+\n+\t//-----------------------------------------------------------------------------\n+\t// Reporting\n+\t//-----------------------------------------------------------------------------\n+\t/** \n+\t * Provide name(s) of the quantities (column labels) of the force value(s) to be reported\n+\t */\n+\tOpenSim::Array<std::string> getRecordLabels() const override;\n+\t/**\n+\t*  Provide the value(s) to be reported that correspond to the labels\n+\t*/\n+\tOpenSim::Array<double> getRecordValues(const SimTK::State& state) const override;\n+\n+\t//--------------------------------------------------------------------------\n+\t// Visible Object Support\n+\t//--------------------------------------------------------------------------\n+\tvoid updateDisplayer(const SimTK::State& s);\n+\tvoid updateGeometry(const SimTK::State& s);\n \n \n protected:\n \n-    //-----------------------------------------------------------------------------\n-    // ModelComponent interface\n-    //-----------------------------------------------------------------------------\n+\t//-----------------------------------------------------------------------------\n+\t// ModelComponent interface\n+\t//-----------------------------------------------------------------------------\n     void extendConnectToModel(Model& model) override;\n     void extendAddToSystem(SimTK::MultibodySystem& system) const override;\n \n-    /** how to display the Spring */\n-    VisibleObject _displayer;\n-\n private:\n-    void setNull();\n-    void constructProperties();\n+\tvoid setNull();\n+\tvoid constructProperties();\n \n-    // parser programs for efficiently evaluating the expressions\n-    Lepton::ExpressionProgram _forceProg;\n+\t// parser programs for efficiently evaluating the expressions\n+\tLepton::ExpressionProgram _forceProg;\n \n     // Temporary solution until implemented with Connectors\n     SimTK::ReferencePtr<const PhysicalFrame> _body1;\n     SimTK::ReferencePtr<const PhysicalFrame> _body2;\n-    SimTK::ReferencePtr<const SimTK::MobilizedBody> _b1; \n-    SimTK::ReferencePtr<const SimTK::MobilizedBody> _b2;\n+\tSimTK::ReferencePtr<const SimTK::MobilizedBody> _b1; \n+\tSimTK::ReferencePtr<const SimTK::MobilizedBody> _b2;\n \n //==============================================================================\n-};  // END of class override\n+};\t// END of class override\n \n }; //namespace\n //==============================================================================\ndiff --git a/OpenSim/Simulation/Model/FunctionBasedBushingForce.cpp b/OpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\nindex 640d3245a..451420cd4 100644\n--- a/OpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\n+++ b/OpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\n@@ -43,7 +43,7 @@ using namespace OpenSim;\n // Default constructor.\n FunctionBasedBushingForce::FunctionBasedBushingForce()\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n }\n \n@@ -51,19 +51,19 @@ FunctionBasedBushingForce::FunctionBasedBushingForce()\n FunctionBasedBushingForce::FunctionBasedBushingForce(const string&    body1Name, \n                            const Vec3&      point1, \n                            const Vec3&      orientation1,\n-                           const string&    body2Name, \n+\t\t                   const string&    body2Name, \n                            const Vec3&      point2, \n                            const Vec3&      orientation2)\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n \n-    set_body_1(body1Name);\n-    set_body_2(body2Name);\n-    set_location_body_1(point1);\n-    set_orientation_body_1(orientation1);\n-    set_location_body_2(point2);\n-    set_orientation_body_2(orientation2);\n+\tset_body_1(body1Name);\n+\tset_body_2(body2Name);\n+\tset_location_body_1(point1);\n+\tset_orientation_body_1(orientation1);\n+\tset_location_body_2(point2);\n+\tset_orientation_body_2(orientation2);\n     \n }\n \n@@ -71,23 +71,23 @@ FunctionBasedBushingForce::FunctionBasedBushingForce(const string&    body1Name,\n FunctionBasedBushingForce::FunctionBasedBushingForce(const string&    body1Name, \n                            const Vec3&      point1, \n                            const Vec3&      orientation1,\n-                           const string&    body2Name, \n+\t\t                   const string&    body2Name, \n                            const Vec3&      point2, \n                            const Vec3&      orientation2,\n-                           const Vec3&      transStiffness, \n+\t\t\t\t           const Vec3&      transStiffness, \n                            const Vec3&      rotStiffness, \n                            const Vec3&      transDamping, \n                            const Vec3&      rotDamping)\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n \n-    set_body_1(body1Name);\n-    set_body_2(body2Name);\n-    set_location_body_1(point1);\n-    set_orientation_body_1(orientation1);\n-    set_location_body_2(point2);\n-    set_orientation_body_2(orientation2);\n+\tset_body_1(body1Name);\n+\tset_body_2(body2Name);\n+\tset_location_body_1(point1);\n+\tset_orientation_body_1(orientation1);\n+\tset_location_body_2(point2);\n+\tset_orientation_body_2(orientation2);\n     // populate m_ii and f_ii as LinearFunction based on stiffness\n     set_m_x_theta_x_function( LinearFunction( rotStiffness[0], 0.0) );\n     set_m_y_theta_y_function( LinearFunction( rotStiffness[1], 0.0) );\n@@ -95,17 +95,17 @@ FunctionBasedBushingForce::FunctionBasedBushingForce(const string&    body1Name,\n     set_f_x_delta_x_function( LinearFunction( transStiffness[0], 0.0) );\n     set_f_y_delta_y_function( LinearFunction( transStiffness[1], 0.0) );\n     set_f_z_delta_z_function( LinearFunction( transStiffness[2], 0.0) );\n-    set_rotational_damping(rotDamping);\n-    set_translational_damping(transDamping);\n+\tset_rotational_damping(rotDamping);\n+\tset_translational_damping(transDamping);\n }\n \n //_____________________________________________________________________________\n // Set the data members of this FunctionBasedBushingForce to their null values.\n void FunctionBasedBushingForce::setNull()\n {\n-    setAuthors("Matt DeMers");\n+\tsetAuthors("Matt DeMers");\n     _b1 = NULL;\n-    _b2 = NULL;\n+\t_b2 = NULL;\n     // no data members\n }\n \n@@ -113,14 +113,14 @@ void FunctionBasedBushingForce::setNull()\n // Allocate and initialize properties.\n void FunctionBasedBushingForce::constructProperties()\n {\n-    constructProperty_body_1();\n-    constructProperty_body_2();\n+\tconstructProperty_body_1();\n+\tconstructProperty_body_2();\n \n-    //Default location and orientation (rotation sequence)\n-    constructProperty_location_body_1(Vec3(0)); // body origin\n-    constructProperty_orientation_body_1(Vec3(0)); // no rotation\n-    constructProperty_location_body_2(Vec3(0));\n-    constructProperty_orientation_body_2(Vec3(0));\n+\t//Default location and orientation (rotation sequence)\n+\tconstructProperty_location_body_1(Vec3(0)); // body origin\n+\tconstructProperty_orientation_body_1(Vec3(0)); // no rotation\n+\tconstructProperty_location_body_2(Vec3(0));\n+\tconstructProperty_orientation_body_2(Vec3(0));\n \n     //set all deflection functions to zero\n     Constant zeroFunc = Constant(0.0);\n@@ -132,8 +132,8 @@ void FunctionBasedBushingForce::constructProperties()\n     constructProperty_f_z_delta_z_function( zeroFunc );\n     \n     constructProperty_rotational_damping(Vec3(0));\n-    constructProperty_translational_damping(Vec3(0));\n-    \n+\tconstructProperty_translational_damping(Vec3(0));\n+\t\n     constructProperty_moment_visual_scale( 1.0 );\n     constructProperty_force_visual_scale( 1.0 );\n     constructProperty_visual_aspect_ratio(1.0);\n@@ -152,8 +152,8 @@ void FunctionBasedBushingForce::extendConnectToModel(Model& aModel)\n \n     // Look up the two bodies being connected by bushing by name in the\n     // model. TODO: use Connectors\n-    const string& body1Name = get_body_1(); // error if unspecified\n-    const string& body2Name = get_body_2();\n+\tconst string& body1Name = get_body_1(); // error if unspecified\n+\tconst string& body2Name = get_body_2();\n \n     _body1 =\n         static_cast<const PhysicalFrame*>(&getModel().getComponent(body1Name));\n@@ -165,25 +165,25 @@ void FunctionBasedBushingForce::extendAddToSystem(SimTK::MultibodySystem& system\n {\n     Super::extendAddToSystem(system);\n \n-    const string&      body1Name            = get_body_1();\n-    const string&      body2Name            = get_body_2();\n-    const SimTK::Vec3& locationInBody1      = get_location_body_1();\n-    const SimTK::Vec3& orientationInBody1   = get_orientation_body_1();\n-    const SimTK::Vec3& locationInBody2      = get_location_body_2();\n-    const SimTK::Vec3& orientationInBody2   = get_orientation_body_2();\n+\tconst string&      body1Name            = get_body_1();\n+\tconst string&      body2Name            = get_body_2();\n+\tconst SimTK::Vec3& locationInBody1      = get_location_body_1();\n+\tconst SimTK::Vec3& orientationInBody1   = get_orientation_body_1();\n+\tconst SimTK::Vec3& locationInBody2      = get_location_body_2();\n+\tconst SimTK::Vec3& orientationInBody2   = get_orientation_body_2();\n \n     // Beyond the const Component get access to underlying SimTK elements\n-    FunctionBasedBushingForce* mutableThis = const_cast<FunctionBasedBushingForce *>(this);\n+\tFunctionBasedBushingForce* mutableThis = const_cast<FunctionBasedBushingForce *>(this);\n \n     // Get underlying mobilized bodies\n     mutableThis->_b1 = _body1->getMobilizedBody();\n     mutableThis->_b2 = _body2->getMobilizedBody();\n-    // Define the transforms for the bushing frames affixed to the specified bodies\n-    SimTK::Rotation r1; r1.setRotationToBodyFixedXYZ(orientationInBody1);\n-    SimTK::Rotation r2; r2.setRotationToBodyFixedXYZ(orientationInBody2);\n-    // Hang on to the transforms for the bushing frames\n-    mutableThis->_inb1 = SimTK::Transform(r1, locationInBody1);\n-    mutableThis->_inb2 = SimTK::Transform(r2, locationInBody2);\n+\t// Define the transforms for the bushing frames affixed to the specified bodies\n+\tSimTK::Rotation r1; r1.setRotationToBodyFixedXYZ(orientationInBody1);\n+\tSimTK::Rotation r2; r2.setRotationToBodyFixedXYZ(orientationInBody2);\n+\t// Hang on to the transforms for the bushing frames\n+\tmutableThis->_inb1 = SimTK::Transform(r1, locationInBody1);\n+\tmutableThis->_inb2 = SimTK::Transform(r2, locationInBody2);\n }\n \n //=============================================================================\n@@ -193,57 +193,57 @@ void FunctionBasedBushingForce::extendAddToSystem(SimTK::MultibodySystem& system\n // The following methods set properties of the bushing Force.\n void FunctionBasedBushingForce::setBody1ByName(const std::string& aBodyName)\n {\n-    set_body_1(aBodyName);\n+\tset_body_1(aBodyName);\n }\n \n void FunctionBasedBushingForce::setBody2ByName(const std::string& aBodyName)\n {\n-    set_body_2(aBodyName);\n+\tset_body_2(aBodyName);\n }\n \n /** Set the location and orientation (optional) for weld on body 1*/\n void FunctionBasedBushingForce::setBody1BushingLocation(const Vec3& location, \n                                            const Vec3& orientation)\n {\n-    set_location_body_1(location);\n-    set_orientation_body_1(orientation);\n+\tset_location_body_1(location);\n+\tset_orientation_body_1(orientation);\n }\n \n /** Set the location and orientation (optional) for weld on body 2*/\n void FunctionBasedBushingForce::setBody2BushingLocation(const Vec3& location, \n                                            const Vec3& orientation)\n {\n-    set_location_body_2(location);\n-    set_orientation_body_2(orientation);\n+\tset_location_body_2(location);\n+\tset_orientation_body_2(orientation);\n }\n \n //=============================================================================\n // COMPUTATION\n //=============================================================================\n /** Compute the deflection (spatial separation) of the two frames connected\n-    by the bushing force. Angualar displacement expressed in Euler angles.\n-    The force and potential energy are determined by the deflection.  */\n+\tby the bushing force. Angualar displacement expressed in Euler angles.\n+\tThe force and potential energy are determined by the deflection.  */\n SimTK::Vec6 FunctionBasedBushingForce::computeDeflection(const SimTK::State& s) const\n {\n-    const Transform& X_GB1 = _b1->getBodyTransform(s);\n+\tconst Transform& X_GB1 = _b1->getBodyTransform(s);\n \n     const Transform& X_GB2 = _b2->getBodyTransform(s);\n \n-    // Define the frame on body 1 is the "fixed" frame, F\n-    Transform X_GF = X_GB1 * _inb1;\n-    // Define the frame on body 2 as the "moving" frame, M\n+\t// Define the frame on body 1 is the "fixed" frame, F\n+\tTransform X_GF = X_GB1 * _inb1;\n+\t// Define the frame on body 2 as the "moving" frame, M\n     Transform X_GM = X_GB2 * _inb2;\n-    // Express M in F\n+\t// Express M in F\n     Transform X_FM = ~X_GF * X_GM;    \n \n-    // the deviation of the two frames measured by dq\n+\t// the deviation of the two frames measured by dq\n     Vec6 dq(0);\n-    // First 3 are rotational deviations\n-    dq.updSubVec<3>(0) = X_FM.R().convertRotationToBodyFixedXYZ();\n-    // Second 3 are translational\n-    dq.updSubVec<3>(3) = X_FM.p();\n+\t// First 3 are rotational deviations\n+\tdq.updSubVec<3>(0) = X_FM.R().convertRotationToBodyFixedXYZ();\n+\t// Second 3 are translational\n+\tdq.updSubVec<3>(3) = X_FM.p();\n \n-    return dq;\n+\treturn dq;\n }\n \n /** compute the bushing force at the bushing location\n@@ -254,15 +254,15 @@ void FunctionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& state\n     const Transform& X_GB1 = _b1->getBodyTransform(state);\n     const Transform& X_GB2 = _b2->getBodyTransform(state);\n \n-    Transform X_GF = X_GB1 * _inb1;   \n+\tTransform X_GF = X_GB1 * _inb1;   \n     Transform X_GM = X_GB2 * _inb2;   \n     Transform X_FM = ~X_GF * X_GM;    \n-    const Rotation& R_GF = X_GF.R();\n-    const Rotation& R_GM = X_GM.R();\n-    const Rotation& R_FM = X_FM.R();\n+\tconst Rotation& R_GF = X_GF.R();\n+\tconst Rotation& R_GM = X_GM.R();\n+\tconst Rotation& R_FM = X_FM.R();\n \n     // Calculate stiffness generalized forces of bushing by first computing\n-    // the deviation of the two frames measured by dq\n+\t// the deviation of the two frames measured by dq\n     Vec6 dq = computeDeflection(state);\n \n     // TO DO: compute the deflection forces from functions\n@@ -280,7 +280,7 @@ void FunctionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& state\n     const SpatialVec& V_GB1 = _b1->getBodyVelocity(state);\n     const SpatialVec& V_GB2 = _b2->getBodyVelocity(state);\n \n-    // Re-express local vectors in the Ground frame.\n+\t// Re-express local vectors in the Ground frame.\n     Vec3 p_B1F_G =  X_GB1.R() * _inb1.p();   // 15 flops\n     Vec3 p_B2M_G =  X_GB2.R() * _inb2.p();   // 15 flops\n     Vec3 p_FM_G  =  X_GF.R()  * X_FM.p();    // 15 flops\n@@ -304,7 +304,7 @@ void FunctionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& state\n     // Need angular velocity in M frame for conversion to qdot.\n     const Vec3  w_FM_M = ~R_FM * V_FM[0];\n     const Mat33 N_FM   = Rotation::calcNForBodyXYZInBodyFrame(dq.getSubVec<3>(0));\n-    Vec6 dqdot(0);\n+\tVec6 dqdot(0);\n     dqdot.updSubVec<3>(0) = N_FM * w_FM_M;\n     dqdot.updSubVec<3>(3) = V_FM[1];\n \n@@ -317,12 +317,12 @@ void FunctionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& state\n         _dampingMatrix[i][i] = get_rotational_damping(0)[i];\n         _dampingMatrix[i+3][i+3] = get_translational_damping(0)[i];\n     }\n-    \n-    // velocity dependent force according to the speed of frame2 on \n-    // body2 relative to frame1 \n-    Vec6 fv = _dampingMatrix * dqdot;\n+\t\n+\t// velocity dependent force according to the speed of frame2 on \n+\t// body2 relative to frame1 \n+\tVec6 fv = _dampingMatrix * dqdot;\n \n-    Vec6 f = -(fk+fv); // generalized forces on body 2\n+\tVec6 f = -(fk+fv); // generalized forces on body 2\n     const Vec3& fB2_q = f.getSubVec<3>(0); // in q basis\n     const Vec3& fM_F  = f.getSubVec<3>(3); // acts at M, but exp. in F frame\n \n@@ -356,8 +356,8 @@ void FunctionBasedBushingForce::ComputeForcesAtBushing(const SimTK::State& state\n  * developed and implemented by Michael Sherman.\n  */\n void FunctionBasedBushingForce::computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const\n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const\n {\n     \n     \n@@ -371,12 +371,12 @@ void FunctionBasedBushingForce::computeForce(const SimTK::State& s,\n     const Transform& X_GB1 = _b1->getBodyTransform(s);\n     const Transform& X_GB2 = _b2->getBodyTransform(s);\n \n-    Transform X_GF = X_GB1 * _inb1;   \n+\tTransform X_GF = X_GB1 * _inb1;   \n     Transform X_GM = X_GB2 * _inb2;   \n     Transform X_FM = ~X_GF * X_GM;    \n-    const Rotation& R_GF = X_GF.R();\n-    const Rotation& R_GM = X_GM.R();\n-    const Rotation& R_FM = X_FM.R();\n+\tconst Rotation& R_GF = X_GF.R();\n+\tconst Rotation& R_GM = X_GM.R();\n+\tconst Rotation& R_FM = X_FM.R();\n \n     // Re-express local vectors in the Ground frame.\n     Vec3 p_B1F_G =  X_GB1.R() * _inb1.p();   // 15 flops\n@@ -387,8 +387,8 @@ void FunctionBasedBushingForce::computeForce(const SimTK::State& s,\n     SpatialVec F_GB2(F_GM[0] + p_B2M_G % F_GM[1], F_GM[1]);\n     SpatialVec F_GB1(F_GF[0] + p_B1F_G % F_GF[1], F_GF[1]);\n \n-    // Apply (add-in) the body forces to the system set of body forces\n-    bodyForces[_b2->getMobilizedBodyIndex()] += F_GB2;\n+\t// Apply (add-in) the body forces to the system set of body forces\n+\tbodyForces[_b2->getMobilizedBodyIndex()] += F_GB2;\n     bodyForces[_b1->getMobilizedBodyIndex()] += F_GB1;\n }\n \n@@ -397,10 +397,10 @@ void FunctionBasedBushingForce::computeForce(const SimTK::State& s,\n /**\n double CoupledBushingForce::computePotentialEnergy(const SimTK::State& s) const\n {\n-    Vec6 dq = computeDeflection(s);\n-    // Energy stored in the bushing\n-    double U = 0.5*(~dq*_stiffnessMatrix*dq);\n-    return U;\n+\tVec6 dq = computeDeflection(s);\n+\t// Energy stored in the bushing\n+\tdouble U = 0.5*(~dq*_stiffnessMatrix*dq);\n+\treturn U;\n }\n */\n \n@@ -408,7 +408,7 @@ double CoupledBushingForce::computePotentialEnergy(const SimTK::State& s) const\n /* Potential energy is computed by underlying SimTK::Force. */\n double FunctionBasedBushingForce::computePotentialEnergy(const SimTK::State& s) const\n {\n-    return _model->getForceSubsystem().getForce(_index)\n+\treturn _model->getForceSubsystem().getForce(_index)\n                                       .calcPotentialEnergyContribution(s);\n }\n \n@@ -421,24 +421,24 @@ double FunctionBasedBushingForce::computePotentialEnergy(const SimTK::State& s)\n  */\n OpenSim::Array<std::string> FunctionBasedBushingForce::getRecordLabels() const \n {\n-    const string& body1Name = get_body_1();\n-    const string& body2Name = get_body_2();\n-\n-    OpenSim::Array<std::string> labels("");\n-    labels.append(getName()+"."+body1Name+".force.X");\n-    labels.append(getName()+"."+body1Name+".force.Y");\n-    labels.append(getName()+"."+body1Name+".force.Z");\n-    labels.append(getName()+"."+body1Name+".torque.X");\n-    labels.append(getName()+"."+body1Name+".torque.Y");\n-    labels.append(getName()+"."+body1Name+".torque.Z");\n-    labels.append(getName()+"."+body2Name+".force.X");\n-    labels.append(getName()+"."+body2Name+".force.Y");\n-    labels.append(getName()+"."+body2Name+".force.Z");\n-    labels.append(getName()+"."+body2Name+".torque.X");\n-    labels.append(getName()+"."+body2Name+".torque.Y");\n-    labels.append(getName()+"."+body2Name+".torque.Z");\n-\n-    return labels;\n+\tconst string& body1Name = get_body_1();\n+\tconst string& body2Name = get_body_2();\n+\n+\tOpenSim::Array<std::string> labels("");\n+\tlabels.append(getName()+"."+body1Name+".force.X");\n+\tlabels.append(getName()+"."+body1Name+".force.Y");\n+\tlabels.append(getName()+"."+body1Name+".force.Z");\n+\tlabels.append(getName()+"."+body1Name+".torque.X");\n+\tlabels.append(getName()+"."+body1Name+".torque.Y");\n+\tlabels.append(getName()+"."+body1Name+".torque.Z");\n+\tlabels.append(getName()+"."+body2Name+".force.X");\n+\tlabels.append(getName()+"."+body2Name+".force.Y");\n+\tlabels.append(getName()+"."+body2Name+".force.Z");\n+\tlabels.append(getName()+"."+body2Name+".torque.X");\n+\tlabels.append(getName()+"."+body2Name+".torque.Y");\n+\tlabels.append(getName()+"."+body2Name+".torque.Z");\n+\n+\treturn labels;\n }\n /**\n  * Provide the value(s) to be reported that correspond to the labels\n@@ -454,79 +454,76 @@ getRecordValues(const SimTK::State& state) const\n     OpenSim::Array<double> values(1);\n \n     values.append(3, &F_GF[1][0]);\n-    values.append(3, &F_GF[0][0]);\n+\tvalues.append(3, &F_GF[0][0]);\n     values.append(3, &F_GM[1][0]);\n-    values.append(3, &F_GM[0][0]);\n+\tvalues.append(3, &F_GM[0][0]);\n \n \n     /*  Old stuff reporting body forces at body origin\n     -----------------------------------------------------\n-    const string& body1Name = get_body_1();\n-    const string& body2Name = get_body_2();\n+\tconst string& body1Name = get_body_1();\n+\tconst string& body2Name = get_body_2();\n \n-    OpenSim::Array<double> values(1);\n+\tOpenSim::Array<double> values(1);\n \n-    const SimTK::Force::LinearBushing &simtkSpring = \n+\tconst SimTK::Force::LinearBushing &simtkSpring = \n         (SimTK::Force::LinearBushing &)(_model->getForceSubsystem().getForce(_index));\n \n-    SimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n-    SimTK::Vector_<SimTK::Vec3> particleForces(0);\n-    SimTK::Vector mobilityForces(0);\n+\tSimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n+\tSimTK::Vector_<SimTK::Vec3> particleForces(0);\n+\tSimTK::Vector mobilityForces(0);\n \n-    //get the net force added to the system contributed by the bushing\n-    simtkSpring.calcForceContribution(state, bodyForces, particleForces, mobilityForces);\n-    SimTK::Vec3 forces = bodyForces(_model->getBodySet().get(body1Name).getIndex())[1];\n-    SimTK::Vec3 torques = bodyForces(_model->getBodySet().get(body1Name).getIndex())[0];\n-    values.append(3, &forces[0]);\n-    values.append(3, &torques[0]);\n+\t//get the net force added to the system contributed by the bushing\n+\tsimtkSpring.calcForceContribution(state, bodyForces, particleForces, mobilityForces);\n+\tSimTK::Vec3 forces = bodyForces(_model->getBodySet().get(body1Name).getIndex())[1];\n+\tSimTK::Vec3 torques = bodyForces(_model->getBodySet().get(body1Name).getIndex())[0];\n+\tvalues.append(3, &forces[0]);\n+\tvalues.append(3, &torques[0]);\n \n-    forces = bodyForces(_model->getBodySet().get(body2Name).getIndex())[1];\n-    torques = bodyForces(_model->getBodySet().get(body2Name).getIndex())[0];\n+\tforces = bodyForces(_model->getBodySet().get(body2Name).getIndex())[1];\n+\ttorques = bodyForces(_model->getBodySet().get(body2Name).getIndex())[0];\n \n-    values.append(3, &forces[0]);\n-    values.append(3, &torques[0]);\n+\tvalues.append(3, &forces[0]);\n+\tvalues.append(3, &torques[0]);\n \n     */\n \n-    return values;\n+\treturn values;\n }\n \n //_____________________________________________________________________________\n /**\n  * Get the visible object used to represent the spring.\n  */\n-VisibleObject* FunctionBasedBushingForce::getDisplayer() const\n-{ \n-    return const_cast<VisibleObject*>(&_displayer); \n-}\n+\n \n void FunctionBasedBushingForce::updateDisplayer(const SimTK::State& s)\n {\n-    SimTK::Vec3 globalLocation1, globalLocation2;\n-    const OpenSim::Body& body1 = _model->getBodySet().get(get_body_1());\n-    const OpenSim::Body& body2 = _model->getBodySet().get(get_body_2());\n-    _model->getSimbodyEngine().transformPosition(s, body1, get_location_body_1(), \n+\tSimTK::Vec3 globalLocation1, globalLocation2;\n+\tconst OpenSim::Body& body1 = _model->getBodySet().get(get_body_1());\n+\tconst OpenSim::Body& body2 = _model->getBodySet().get(get_body_2());\n+\t_model->getSimbodyEngine().transformPosition(s, body1, get_location_body_1(), \n                                                  globalLocation1);\n-    _model->getSimbodyEngine().transformPosition(s, body2, get_location_body_2(),\n+\t_model->getSimbodyEngine().transformPosition(s, body2, get_location_body_2(),\n                                                  globalLocation2);\n-\n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    ((LineGeometry *)_displayer.getGeometry(0))->\n-        setPoints(globalLocation1, globalLocation2);\n+    /*\n+\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t}\n+\t((LineGeometry *)_displayer.getGeometry(0))->\n+        setPoints(globalLocation1, globalLocation2);*/\n }\n \n void FunctionBasedBushingForce::updateGeometry(const SimTK::State& s)\n {\n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    updateDisplayer(s);\n+/*\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t}*/\n+\tupdateDisplayer(s);\n }\n \n void FunctionBasedBushingForce::generateDecorations\ndiff --git a/OpenSim/Simulation/Model/FunctionBasedBushingForce.h b/OpenSim/Simulation/Model/FunctionBasedBushingForce.h\nindex 9eb6dec7b..b5c6da465 100644\n--- a/OpenSim/Simulation/Model/FunctionBasedBushingForce.h\n+++ b/OpenSim/Simulation/Model/FunctionBasedBushingForce.h\n@@ -61,18 +61,18 @@ public:\n     /** @name Property declarations\n     These are the serializable properties associated with this class. **/\n     /**@{**/\n-    OpenSim_DECLARE_OPTIONAL_PROPERTY(body_1, std::string,\n-        "One of the two bodies connected by the bushing.");\n-    OpenSim_DECLARE_OPTIONAL_PROPERTY(body_2, std::string,\n-        "The other of the two bodies connected by the bushing.");\n-    OpenSim_DECLARE_PROPERTY(location_body_1, SimTK::Vec3,\n-        "Location of bushing frame on body 1.");\n-    OpenSim_DECLARE_PROPERTY(orientation_body_1, SimTK::Vec3,\n-        "Orientation of bushing frame in body 1 as x-y-z, body fixed Euler rotations.");\n-    OpenSim_DECLARE_PROPERTY(location_body_2, SimTK::Vec3,\n-        "Location of bushing frame on body 2.");\n-    OpenSim_DECLARE_PROPERTY(orientation_body_2, SimTK::Vec3,\n-        "Orientation of bushing frame in body 2 as x-y-z, body fixed Euler rotations.");\n+\tOpenSim_DECLARE_OPTIONAL_PROPERTY(body_1, std::string,\n+\t\t"One of the two bodies connected by the bushing.");\n+\tOpenSim_DECLARE_OPTIONAL_PROPERTY(body_2, std::string,\n+\t\t"The other of the two bodies connected by the bushing.");\n+\tOpenSim_DECLARE_PROPERTY(location_body_1, SimTK::Vec3,\n+\t\t"Location of bushing frame on body 1.");\n+\tOpenSim_DECLARE_PROPERTY(orientation_body_1, SimTK::Vec3,\n+\t\t"Orientation of bushing frame in body 1 as x-y-z, body fixed Euler rotations.");\n+\tOpenSim_DECLARE_PROPERTY(location_body_2, SimTK::Vec3,\n+\t\t"Location of bushing frame on body 2.");\n+\tOpenSim_DECLARE_PROPERTY(orientation_body_2, SimTK::Vec3,\n+\t\t"Orientation of bushing frame in body 2 as x-y-z, body fixed Euler rotations.");\n     OpenSim_DECLARE_OPTIONAL_PROPERTY(m_x_theta_x_function, Function,\n         "Function defining the contribution of theta_x deflection to the moment about body_2\'s x axis.");\n     OpenSim_DECLARE_OPTIONAL_PROPERTY(m_y_theta_y_function, Function,\n@@ -95,47 +95,46 @@ public:\n     // To do:  Delete these stiffness properties\n     //--------------------------------------------------------\n     /*\n-    OpenSim_DECLARE_PROPERTY(rotational_stiffness, SimTK::Vec3,\n-        "Stiffness parameters resisting relative rotation.");\n-    OpenSim_DECLARE_PROPERTY(translational_stiffness, SimTK::Vec3,\n-        "Stiffness parameters resisting relative translation.");\n+\tOpenSim_DECLARE_PROPERTY(rotational_stiffness, SimTK::Vec3,\n+\t\t"Stiffness parameters resisting relative rotation.");\n+\tOpenSim_DECLARE_PROPERTY(translational_stiffness, SimTK::Vec3,\n+\t\t"Stiffness parameters resisting relative translation.");\n     */\n     //-------------------------------------------------------\n-    OpenSim_DECLARE_PROPERTY(rotational_damping, SimTK::Vec3,\n-        "Damping parameters resisting relative angular velocity.");\n-    OpenSim_DECLARE_PROPERTY(translational_damping, SimTK::Vec3,\n-        "Damping parameters resisting relative translational velocity.");\n+\tOpenSim_DECLARE_PROPERTY(rotational_damping, SimTK::Vec3,\n+\t\t"Damping parameters resisting relative angular velocity.");\n+\tOpenSim_DECLARE_PROPERTY(translational_damping, SimTK::Vec3,\n+\t\t"Damping parameters resisting relative translational velocity.");\n     /**@}**/\n \n protected:\n     /** how to display the bushing */\n-    VisibleObject _displayer;\n \n public:\n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    /** Default constructor leaves bodies unspecified, sets the bushing frames\n+\t/** Default constructor leaves bodies unspecified, sets the bushing frames\n       * to be at their body origins, and sets all bushing parameters to zero. **/\n-    FunctionBasedBushingForce();\n+\tFunctionBasedBushingForce();\n     /** This convenience constructor defines and sets the bushing frames on \n       * each body, and sets all bushing functions to zero.  **/\n     FunctionBasedBushingForce(const std::string& body1Name, \n                  const SimTK::Vec3& point1, \n                  const SimTK::Vec3& orientation1,\n-                 const std::string& body2Name, \n+\t\t         const std::string& body2Name, \n                  const SimTK::Vec3& point2, \n                  const SimTK::Vec3& orientation2);\n     /** This convenience constructor defines a bushing that behaves like a\n       * primitive bushing.  Stiffnesses are used to define linear functions for\n       * force deflection profiles.**/\n-    FunctionBasedBushingForce(const std::string& body1Name, \n+\tFunctionBasedBushingForce(const std::string& body1Name, \n                  const SimTK::Vec3& point1, \n                  const SimTK::Vec3& orientation1,\n-                 const std::string& body2Name, \n+\t\t         const std::string& body2Name, \n                  const SimTK::Vec3& point2, \n                  const SimTK::Vec3& orientation2,\n-                 const SimTK::Vec3& transStiffness, \n+\t\t\t\t const SimTK::Vec3& transStiffness, \n                  const SimTK::Vec3& rotStiffness, \n                  const SimTK::Vec3& transDamping, \n                  const SimTK::Vec3& rotDamping);\n@@ -143,17 +142,17 @@ public:\n     // Uses default (compiler-generated) destructor, copy constructor, and copy\n     // assignment operator.\n \n-    /** Set the name of the Body that will serve as body 1 for this bushing. **/\n-    void setBody1ByName(const std::string& aBodyName);\n+\t/** Set the name of the Body that will serve as body 1 for this bushing. **/\n+\tvoid setBody1ByName(const std::string& aBodyName);\n     /** Set the location and orientation (optional) for bushing frame on \n       * body 1. **/\n-    void setBody1BushingLocation(const SimTK::Vec3& location, \n+\tvoid setBody1BushingLocation(const SimTK::Vec3& location, \n                                  const SimTK::Vec3& orientation=SimTK::Vec3(0));\n-    /** Set the name of the Body that will serve as body 2 for this bushing. **/\n-    void setBody2ByName(const std::string& aBodyName);\n+\t/** Set the name of the Body that will serve as body 2 for this bushing. **/\n+\tvoid setBody2ByName(const std::string& aBodyName);\n     /** Set the location and orientation (optional) for bushing frame on \n       * body 2. **/\n-    void setBody2BushingLocation(const SimTK::Vec3& location, \n+\tvoid setBody2BushingLocation(const SimTK::Vec3& location, \n                                  const SimTK::Vec3& orientation=SimTK::Vec3(0));\n     /** Set the value used to scale the bushing moment on body2 when drawing it to screen.  \n       * A moment of magnitude |M| will be drawn on screen with a length of (|M|*scale).  **/\n@@ -164,39 +163,39 @@ public:\n     /** Set the aspect ratio used to control the thickness of the bushing force and moment\n         in drawn in the visualizer.  ratio = length/diameter.*/\n     void setVisualAspectRatio(double ratio) {set_visual_aspect_ratio(ratio);}\n-    //--------------------------------------------------------------------------\n-    // COMPUTATION\n-    //--------------------------------------------------------------------------\n-    /** Compute the deflection (spatial separation) of the two frames connected\n-      * by the bushing force. Angualar displacement expressed in Euler angles.\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATION\n+\t//--------------------------------------------------------------------------\n+\t/** Compute the deflection (spatial separation) of the two frames connected\n+\t  * by the bushing force. Angualar displacement expressed in Euler angles.\n       * The force and potential energy are determined by the deflection.  */\n-    virtual SimTK::Vec6 computeDeflection(const SimTK::State& s) const;\n+\tvirtual SimTK::Vec6 computeDeflection(const SimTK::State& s) const;\n \n-    /** Compute the bushing force contribution to the system and add in to appropriate\n-      * bodyForce and/or system generalizedForce. \n-      */\n-    virtual void computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const;\n+\t/** Compute the bushing force contribution to the system and add in to appropriate\n+\t  * bodyForce and/or system generalizedForce. \n+\t  */\n+\tvirtual void computeForce(const SimTK::State& s, \n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const;\n \n     /** Potential energy is determined by the elastic energy storage of the bushing.\n-      * In spatial terms, U = ~dq*[K]*dq, with K and dq defined above. */\n-    virtual double computePotentialEnergy(const SimTK::State& s) const;\n+\t  * In spatial terms, U = ~dq*[K]*dq, with K and dq defined above. */\n+\tvirtual double computePotentialEnergy(const SimTK::State& s) const;\n \n     \n \n-    //--------------------------------------------------------------------------\n-    // Reporting\n-    //--------------------------------------------------------------------------\n-    /** \n-     * Provide name(s) of the quantities (column labels) of the force value(s) \n+\t//--------------------------------------------------------------------------\n+\t// Reporting\n+\t//--------------------------------------------------------------------------\n+\t/** \n+\t * Provide name(s) of the quantities (column labels) of the force value(s) \n      * to be reported.\n-     */\n-    virtual OpenSim::Array<std::string> getRecordLabels() const ;\n-    /**\n-    *  Provide the value(s) to be reported that correspond to the labels\n-    */\n-    virtual OpenSim::Array<double> getRecordValues(const SimTK::State& state) const ;\n+\t */\n+\tvirtual OpenSim::Array<std::string> getRecordLabels() const ;\n+\t/**\n+\t*  Provide the value(s) to be reported that correspond to the labels\n+\t*/\n+\tvirtual OpenSim::Array<double> getRecordValues(const SimTK::State& state) const ;\n \n protected:\n     //--------------------------------------------------------------------------\n@@ -212,21 +211,20 @@ protected:\n                                 SimTK::SpatialVec& forces_on_F_in_ground) const;\n \n private:\n-    //--------------------------------------------------------------------------\n-    // Implement ModelComponent interface.\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// Implement ModelComponent interface.\n+\t//--------------------------------------------------------------------------\n     void extendConnectToModel(Model& aModel) override;\n     // Create a SimTK::Force::LinearBushing which implements this\n     // FunctionBasedBushingForce.\n     void extendAddToSystem(SimTK::MultibodySystem& system) const override;\n     //--------------------------------------------------------------------------\n-    // Visible Object Support for Java Gui\n-    //--------------------------------------------------------------------------\n-    virtual VisibleObject* getDisplayer() const;\n-    virtual void updateDisplayer(const SimTK::State& s);\n-    virtual void updateGeometry(const SimTK::State& s);\n-    void setNull();\n-    void constructProperties();\n+\t// Visible Object Support for Java Gui\n+\t//--------------------------------------------------------------------------\n+\tvirtual void updateDisplayer(const SimTK::State& s);\n+\tvirtual void updateGeometry(const SimTK::State& s);\n+\tvoid setNull();\n+\tvoid constructProperties();\n \n private:\n     // Temporary solution until implemented with Connectors\n@@ -241,7 +239,7 @@ private:\n     SimTK::Transform _inb2;\n \n //==============================================================================\n-};  // END of class FunctionBasedBushingForce\n+};\t// END of class FunctionBasedBushingForce\n //==============================================================================\n //==============================================================================\n \ndiff --git a/OpenSim/Simulation/Model/GeometryPath.cpp b/OpenSim/Simulation/Model/GeometryPath.cpp\nindex 8b2271d78..f419c3b69 100644\n--- a/OpenSim/Simulation/Model/GeometryPath.cpp\n+++ b/OpenSim/Simulation/Model/GeometryPath.cpp\n@@ -25,6 +25,7 @@\n // INCLUDES\n //=============================================================================\n #include "GeometryPath.h"\n+#include <OpenSim/Common/Geometry.h>\n #include <OpenSim/Simulation/SimbodyEngine/Coordinate.h>\n #include <OpenSim/Simulation/SimbodyEngine/Body.h>\n #include <OpenSim/Simulation/SimbodyEngine/SimbodyEngine.h>\n@@ -70,13 +71,7 @@ GeometryPath::GeometryPath() :\n  */\n GeometryPath::~GeometryPath()\n {\n-    VisibleObject* disp;\n-    if ((disp = &upd_display())) {\n-        // Free up allocated geometry objects\n-        disp->freeGeometry();\n-    }\n-\n-    delete _maSolver;\n+\tdelete _maSolver;\n }\n \n \n@@ -87,7 +82,7 @@ GeometryPath::~GeometryPath()\n void GeometryPath::setNull()\n {\n     setAuthors("Peter Loan");\n-    _maSolver = NULL;\n+\t_maSolver = NULL;\n }\n \n //_____________________________________________________________________________\n@@ -114,14 +109,8 @@ void GeometryPath::extendConnectToModel(Model& aModel)\n \n     for (int i = 0; i < get_PathPointSet().getSize(); i++){\n         upd_PathPointSet().get(i).connectToModelAndPath(aModel, *this);\n-        // GeometryPath points depend on the path itself\n-        // Removing the dependency since path points now display as part of the\n-        // path itself, extracted directly from the set of line segments\n-        // representing the path path. -Ayman 02/07\n-        //getDisplayer()->addDependent(get_PathPointSet().get(i)->getDisplayer());\n     }\n \n-    upd_display().setOwner(this);\n }\n \n //_____________________________________________________________________________\n@@ -171,7 +160,7 @@ void GeometryPath::\n generateDecorations(bool fixed, const ModelDisplayHints& hints, \n                     const SimTK::State& state, \n                     SimTK::Array_<SimTK::DecorativeGeometry>& appendToThis) const\n-{       \n+{\t\t\n     Super::generateDecorations(fixed, hints, state, appendToThis);\n \n     // There is no fixed geometry to generate here.\n@@ -189,7 +178,7 @@ generateDecorations(bool fixed, const ModelDisplayHints& hints,\n \n     if (points.getSize() == 0) { return; }\n \n-    const PathPoint* lastPoint = points[0]; \n+    const PathPoint* lastPoint = points[0];\t\n     Vec3 lastLoc_B = lastPoint->getLocation();\n     MobilizedBodyIndex lastBody = lastPoint->getBody().getMobilizedBodyIndex();\n \n@@ -229,8 +218,6 @@ void GeometryPath::constructProperties()\n \n     constructProperty_PathWrapSet(PathWrapSet());\n     \n-    constructProperty_display(VisibleObject());\n-\n     Vec3 defaultColor = SimTK::White;\n     constructProperty_default_color(defaultColor);\n }\n@@ -317,17 +304,17 @@ getPointForceDirections(const SimTK::State& s,\n             // Form a vector from start to end, in the inertial frame.\n             direction = (posEnd - posStart);\n \n-            // Check that the two points are not coincident.\n-            // This can happen due to infeasible wrapping of the path,\n-            // when the origin or insertion enters the wrapping surface.\n-            // This is a temporary fix, since the wrap algorithm should\n-            // return NaN for the points and/or throw an Exception- aseth\n-            if (direction.norm() < SimTK::SignificantReal){\n-                direction = direction*SimTK::NaN;\n-            }\n-            else{\n-                direction = direction.normalize();\n-            }\n+\t\t\t// Check that the two points are not coincident.\n+\t\t\t// This can happen due to infeasible wrapping of the path,\n+\t\t\t// when the origin or insertion enters the wrapping surface.\n+\t\t\t// This is a temporary fix, since the wrap algorithm should\n+\t\t\t// return NaN for the points and/or throw an Exception- aseth\n+\t\t\tif (direction.norm() < SimTK::SignificantReal){\n+\t\t\t\tdirection = direction*SimTK::NaN;\n+\t\t\t}\n+\t\t\telse{\n+\t\t\t\tdirection = direction.normalize();\n+\t\t\t}\n \n             // Get resultant direction at each point \n             rPFDs->get(i)->addToDirection(direction);\n@@ -340,8 +327,8 @@ getPointForceDirections(const SimTK::State& s,\n     along the GeometryPath to a set of bodyForces */\n void GeometryPath::addInEquivalentForces(const SimTK::State& s,\n     const double& tension, \n-    SimTK::Vector_<SimTK::SpatialVec>& bodyForces,\n-    SimTK::Vector& mobilityForces) const\n+\tSimTK::Vector_<SimTK::SpatialVec>& bodyForces,\n+\tSimTK::Vector& mobilityForces) const\n {\n     PathPoint* start = NULL;\n     PathPoint* end = NULL;\n@@ -355,11 +342,11 @@ void GeometryPath::addInEquivalentForces(const SimTK::State& s,\n \n     // start point, end point,  direction, and force vectors in ground\n     Vec3 po(0), pf(0), dir(0), force(0);\n-    // partial velocity of point in body expressed in ground \n-    Vec3 dPodq_G(0), dPfdq_G(0);\n+\t// partial velocity of point in body expressed in ground \n+\tVec3 dPodq_G(0), dPfdq_G(0);\n \n-    // gen force (torque) due to moving point under tension\n-    double fo, ff;\n+\t// gen force (torque) due to moving point under tension\n+\tdouble fo, ff;\n \n     for (int i = 0; i < np-1; ++i) {\n         start = currentPath[i];\n@@ -374,65 +361,65 @@ void GeometryPath::addInEquivalentForces(const SimTK::State& s,\n             pf = bf->findStationLocationInGround(s, end->getLocation());\n \n             // Form a vector from start to end, in the inertial frame.\n-            dir = (pf - po);\n-\n-            // Check that the two points are not coincident.\n-            // This can happen due to infeasible wrapping of the path,\n-            // when the origin or insertion enters the wrapping surface.\n-            // This is a temporary fix, since the wrap algorithm should\n-            // return NaN for the points and/or throw an Exception- aseth\n-            if (dir.norm() < SimTK::SignificantReal){\n-                dir = dir*SimTK::NaN;\n-            }\n-            else{\n-                dir = dir.normalize();\n-            }\n-        \n-            force = tension*dir;\n+\t\t\tdir = (pf - po);\n+\n+\t\t\t// Check that the two points are not coincident.\n+\t\t\t// This can happen due to infeasible wrapping of the path,\n+\t\t\t// when the origin or insertion enters the wrapping surface.\n+\t\t\t// This is a temporary fix, since the wrap algorithm should\n+\t\t\t// return NaN for the points and/or throw an Exception- aseth\n+\t\t\tif (dir.norm() < SimTK::SignificantReal){\n+\t\t\t\tdir = dir*SimTK::NaN;\n+\t\t\t}\n+\t\t\telse{\n+\t\t\t\tdir = dir.normalize();\n+\t\t\t}\n+\t\t\n+\t\t\tforce = tension*dir;\n \n             // add in the tension point forces to body forces\n-            bo->applyForceToBodyPoint(s, start->getLocation(), force, \n-                bodyForces);\n-            bf->applyForceToBodyPoint(s, end->getLocation(), -force,\n-                bodyForces);\n-\n-            const MovingPathPoint* mppo = \n-                    dynamic_cast<MovingPathPoint *>(start);\n-\n-            if(mppo){\n-                // torque (genforce) contribution due to relative movement \n-                // of a via point w.r.t. the body it is connected to.\n-                dPodq_G = bo->expressVectorInGroundFrame(s, start->getdPointdQ(s));\n-                fo = ~dPodq_G*force;            \n-\n-                // get the mobilized body the coordinate is couple to.\n-                const SimTK::MobilizedBody& mpbod =\n-                    matter.getMobilizedBody(mppo->getXCoordinate()->getBodyIndex());\n-\n-                // apply the generalized (mobility) force to the coordinate\'s body\n-                mpbod.applyOneMobilityForce(s, \n-                    mppo->getXCoordinate()->getMobilizerQIndex(), \n-                    fo, mobilityForces);\n-            }\n-\n-            // do the same for the end point of this segment of the path\n-            const MovingPathPoint* mppf = \n-                    dynamic_cast<MovingPathPoint *>(end);\n-\n-            if(mppf){\n-                dPfdq_G = bf->expressVectorInGroundFrame(s, end->getdPointdQ(s));\n-                ff = ~dPfdq_G*(-force);\n-\n-                // get the mobilized body the coordinate is couple to.\n-                const SimTK::MobilizedBody& mpbod =\n-                    matter.getMobilizedBody(mppf->getXCoordinate()->getBodyIndex());\n-\n-                mpbod.applyOneMobilityForce(s, \n-                    mppf->getXCoordinate()->getMobilizerQIndex(), \n-                    ff, mobilityForces);\n-            }\n-            \n-        }       \n+\t\t\tbo->applyForceToBodyPoint(s, start->getLocation(), force, \n+\t\t\t\tbodyForces);\n+\t\t\tbf->applyForceToBodyPoint(s, end->getLocation(), -force,\n+\t\t\t\tbodyForces);\n+\n+\t\t\tconst MovingPathPoint* mppo = \n+\t\t\t\t\tdynamic_cast<MovingPathPoint *>(start);\n+\n+\t\t\tif(mppo){\n+\t\t\t\t// torque (genforce) contribution due to relative movement \n+\t\t\t\t// of a via point w.r.t. the body it is connected to.\n+\t\t\t\tdPodq_G = bo->expressVectorInGroundFrame(s, start->getdPointdQ(s));\n+\t\t\t\tfo = ~dPodq_G*force;\t\t\t\n+\n+\t\t\t\t// get the mobilized body the coordinate is couple to.\n+\t\t\t\tconst SimTK::MobilizedBody& mpbod =\n+\t\t\t\t\tmatter.getMobilizedBody(mppo->getXCoordinate()->getBodyIndex());\n+\n+\t\t\t\t// apply the generalized (mobility) force to the coordinate\'s body\n+\t\t\t\tmpbod.applyOneMobilityForce(s, \n+\t\t\t\t\tmppo->getXCoordinate()->getMobilizerQIndex(), \n+\t\t\t\t\tfo, mobilityForces);\n+\t\t\t}\n+\n+\t\t\t// do the same for the end point of this segment of the path\n+\t\t\tconst MovingPathPoint* mppf = \n+\t\t\t\t\tdynamic_cast<MovingPathPoint *>(end);\n+\n+\t\t\tif(mppf){\n+\t\t\t\tdPfdq_G = bf->expressVectorInGroundFrame(s, end->getdPointdQ(s));\n+\t\t\t\tff = ~dPfdq_G*(-force);\n+\n+\t\t\t\t// get the mobilized body the coordinate is couple to.\n+\t\t\t\tconst SimTK::MobilizedBody& mpbod =\n+\t\t\t\t\tmatter.getMobilizedBody(mppf->getXCoordinate()->getBodyIndex());\n+\n+\t\t\t\tmpbod.applyOneMobilityForce(s, \n+\t\t\t\t\tmppf->getXCoordinate()->getMobilizerQIndex(), \n+\t\t\t\t\tff, mobilityForces);\n+\t\t\t}\n+\t\t\t\n+        }\t\t\n     }\n }\n \n@@ -460,21 +447,21 @@ getCurrentDisplayPath(const SimTK::State& s) const\n  */\n void GeometryPath::updateGeometrySize(const SimTK::State& s) const\n {\n-    const int numberOfSegments = get_display().countGeometry();\n+/*    const int numberOfSegments = get_display().countGeometry();\n     const Array<PathPoint*>& currentDisplayPath = \n         getCacheVariableValue<Array<PathPoint*> >(s, "current_display_path");\n \n     // Track whether we\'re creating geometry from scratch or\n     // just updating\n \n-    GeometryPath* mutableThis = const_cast<GeometryPath*>(this);    \n+    GeometryPath* mutableThis = const_cast<GeometryPath*>(this);\t\n     \n     bool update = (numberOfSegments!=0);  \n     int newNumberOfSegments=currentDisplayPath.getSize()-1;\n     if (newNumberOfSegments <= 0)\n         return;\n     // update geom array to have correct number of entries\n-    if (!update || (update && (newNumberOfSegments != numberOfSegments))) { \n+    if (!update || (update && (newNumberOfSegments != numberOfSegments))) {\t\n         if (newNumberOfSegments > numberOfSegments) { // add entries\n             for (int segment = numberOfSegments; \n                  segment < newNumberOfSegments; \n@@ -485,7 +472,7 @@ void GeometryPath::updateGeometrySize(const SimTK::State& s) const\n                 mutableThis->upd_display().addGeometry(g);\n             }\n         }\n-        else {  // remove entries\n+        else {\t// remove entries\n             for (int segment = numberOfSegments-1;\n                  segment >= newNumberOfSegments; \n                  segment--) //Remove back to front so no array packing is needed\n@@ -494,7 +481,7 @@ void GeometryPath::updateGeometrySize(const SimTK::State& s) const\n                     (mutableThis->upd_display().getGeometry(segment));\n             }\n         }\n-    }\n+    }*/\n }\n \n //_____________________________________________________________________________\n@@ -511,7 +498,7 @@ void GeometryPath::updateGeometryLocations(const SimTK::State& s) const\n         getCacheVariableValue<Array<PathPoint*> >(s, "current_display_path");\n \n     GeometryPath * mutableThis = const_cast<GeometryPath*>(this);\n-\n+    /**\n     for (int i = 0; i < currentDisplayPath.getSize(); i++){\n         PathPoint* nextPoint =currentDisplayPath.get(i);\n         // xform point to global frame\n@@ -531,7 +518,7 @@ void GeometryPath::updateGeometryLocations(const SimTK::State& s) const\n                                 (mutableThis->upd_display().getGeometry(i-1));\n             g->setPoints(previousPointGlobalLocation, globalLocation);\n         }\n-    }\n+    }*/\n }\n \n //_____________________________________________________________________________\n@@ -728,7 +715,7 @@ placeNewPathPoint(const SimTK::State& s, SimTK::Vec3& aOffset, int aIndex,\n             aOffset[i] = get_PathPointSet().get(foo).getLocation()[i] + 0.01;\n         }\n     }\n-    else {  // first point, do nothing?\n+    else {\t// first point, do nothing?\n     }\n }\n \n@@ -805,8 +792,8 @@ bool GeometryPath::deletePathPoint(const SimTK::State& s, int aIndex)\n  * member of all the same groups as the old one, and is inserted in the same\n  * place the old one occupied.\n  *\n- *  @param aOldPathPoint Path point to remove.\n- *  @param aNewPathPoint Path point to add.\n+ *\t@param aOldPathPoint Path point to remove.\n+ *\t@param aNewPathPoint Path point to add.\n  */\n bool GeometryPath::\n replacePathPoint(const SimTK::State& s, PathPoint* aOldPathPoint, \n@@ -1380,8 +1367,8 @@ calcLengthAfterPathComputation(const SimTK::State& s,\n double GeometryPath::\n computeMomentArm(const SimTK::State& s, const Coordinate& aCoord) const\n {\n-    if(!_maSolver)\n-        _maSolver = new MomentArmSolver(*_model);\n+\tif(!_maSolver)\n+\t\t_maSolver = new MomentArmSolver(*_model);\n \n     return  _maSolver->solve(s, aCoord,  *this);\n }\ndiff --git a/OpenSim/Simulation/Model/GeometryPath.h b/OpenSim/Simulation/Model/GeometryPath.h\nindex 7de9ffa7a..60d0a709f 100644\n--- a/OpenSim/Simulation/Model/GeometryPath.h\n+++ b/OpenSim/Simulation/Model/GeometryPath.h\n@@ -28,17 +28,16 @@\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include "OpenSim/Simulation/Model/ModelComponent.h"\n #include <OpenSim/Common/ScaleSet.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include "PathPointSet.h"\n #include <OpenSim/Simulation/Wrap/PathWrapSet.h>\n #include <OpenSim/Simulation/MomentArmSolver.h>\n \n \n #ifdef SWIG\n-    #ifdef OSIMSIMULATION_API\n-        #undef OSIMSIMULATION_API\n-        #define OSIMSIMULATION_API\n-    #endif\n+\t#ifdef OSIMSIMULATION_API\n+\t\t#undef OSIMSIMULATION_API\n+\t\t#define OSIMSIMULATION_API\n+\t#endif\n #endif\n \n namespace OpenSim {\n@@ -63,73 +62,71 @@ OpenSim_DECLARE_CONCRETE_OBJECT(GeometryPath, ModelComponent);\n // DATA\n //=============================================================================\n private:\n-    OpenSim_DECLARE_UNNAMED_PROPERTY(PathPointSet, "The set of points defining the path");\n+\tOpenSim_DECLARE_UNNAMED_PROPERTY(PathPointSet, "The set of points defining the path");\n \n-    OpenSim_DECLARE_PROPERTY(display, VisibleObject, "Used to display the path in the 3D window");\n+\tOpenSim_DECLARE_UNNAMED_PROPERTY(PathWrapSet, "The wrap objecs that are associated with this path");\n+\t\n+\tOpenSim_DECLARE_OPTIONAL_PROPERTY(default_color, SimTK::Vec3, "Used to initialize the colour cache variable");\n \n-    OpenSim_DECLARE_UNNAMED_PROPERTY(PathWrapSet, "The wrap objecs that are associated with this path");\n-    \n-    OpenSim_DECLARE_OPTIONAL_PROPERTY(default_color, SimTK::Vec3, "Used to initialize the colour cache variable");\n+\t// used for scaling tendon and fiber lengths\n+\tdouble _preScaleLength;\n \n-    // used for scaling tendon and fiber lengths\n-    double _preScaleLength;\n+\t// object that owns this GeometryPath object\n+\tSimTK::ReferencePtr<Object> _owner;\n \n-    // object that owns this GeometryPath object\n-    SimTK::ReferencePtr<Object> _owner;\n-\n-    // solver used to compute moment-arms\n-    mutable SimTK::ReferencePtr<MomentArmSolver> _maSolver;\n-    \n+\t// solver used to compute moment-arms\n+\tmutable SimTK::ReferencePtr<MomentArmSolver> _maSolver;\n+\t\n //=============================================================================\n // METHODS\n //=============================================================================\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// CONSTRUCTION\n+\t//--------------------------------------------------------------------------\n public:\n-    GeometryPath();\n-    virtual ~GeometryPath();\n+\tGeometryPath();\n+\tvirtual ~GeometryPath();\n \n-    const PathPointSet& getPathPointSet() const { return get_PathPointSet(); }\n-    PathPointSet& updPathPointSet() { return upd_PathPointSet(); }\n-    const PathWrapSet& getWrapSet() const { return get_PathWrapSet(); }\n-    void addPathWrap(WrapObject& aWrapObject);\n+\tconst PathPointSet& getPathPointSet() const { return get_PathPointSet(); }\n+\tPathPointSet& updPathPointSet() { return upd_PathPointSet(); }\n+\tconst PathWrapSet& getWrapSet() const { return get_PathWrapSet(); }\n+\tvoid addPathWrap(WrapObject& aWrapObject);\n \n-    //--------------------------------------------------------------------------\n-    // UTILITY\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// UTILITY\n+\t//--------------------------------------------------------------------------\n     PathPoint* addPathPoint(const SimTK::State& s, int aIndex, PhysicalFrame& aBody);\n-    PathPoint* appendNewPathPoint(const std::string& proposedName, \n+\tPathPoint* appendNewPathPoint(const std::string& proposedName, \n         PhysicalFrame& aBody, const SimTK::Vec3& aPositionOnBody);\n-    bool canDeletePathPoint( int aIndex);\n-    bool deletePathPoint(const SimTK::State& s, int aIndex);\n-    \n-    void moveUpPathWrap(const SimTK::State& s, int aIndex);\n-    void moveDownPathWrap(const SimTK::State& s, int aIndex);\n-    void deletePathWrap(const SimTK::State& s, int aIndex);\n-    bool replacePathPoint(const SimTK::State& s, PathPoint* aOldPathPoint, PathPoint* aNewPathPoint); \n+\tbool canDeletePathPoint( int aIndex);\n+\tbool deletePathPoint(const SimTK::State& s, int aIndex);\n+\t\n+\tvoid moveUpPathWrap(const SimTK::State& s, int aIndex);\n+\tvoid moveDownPathWrap(const SimTK::State& s, int aIndex);\n+\tvoid deletePathWrap(const SimTK::State& s, int aIndex);\n+\tbool replacePathPoint(const SimTK::State& s, PathPoint* aOldPathPoint, PathPoint* aNewPathPoint); \n \n     //--------------------------------------------------------------------------\n     // GET\n     //--------------------------------------------------------------------------\n-    Object* getOwner() const { return _owner; }\n-    void setOwner(Object *anObject) {_owner = anObject; };\n+\tObject* getOwner() const { return _owner; }\n+\tvoid setOwner(Object *anObject) {_owner = anObject; };\n \n     /** If you call this prior to extendAddToSystem() it will be used to initialize\n     the color cache variable. Otherwise %GeometryPath will choose its own\n     default which will be some boring shade of gray. **/\n-    void setDefaultColor(const SimTK::Vec3& color) {set_default_color(color); };\n+\tvoid setDefaultColor(const SimTK::Vec3& color) {set_default_color(color); };\n     /** Returns the color that will be used to initialize the color cache\n     at the next extendAddToSystem() call. The actual color used to draw the path\n     will be taken from the cache variable, so may have changed. **/\n-    const SimTK::Vec3& getDefaultColor() const { return get_default_color(); }\n+\tconst SimTK::Vec3& getDefaultColor() const { return get_default_color(); }\n \n     /** Set the value of the color cache variable owned by this %GeometryPath\n     object, in the cache of the given state. The value of this variable is used\n     as the color when the path is drawn, which occurs with the state realized \n     to Stage::Dynamics. So you must call this method during realizeDynamics() or \n     earlier in order for it to have any effect. **/\n-    void setColor(const SimTK::State& s, const SimTK::Vec3& color) const;\n+\tvoid setColor(const SimTK::State& s, const SimTK::Vec3& color) const;\n \n     /** Get the current value of the color cache entry owned by this\n     %GeometryPath object in the given state. You can access this value any time\n@@ -137,61 +134,58 @@ public:\n     the default color value specified in a call to setDefaultColor() earlier,\n     or it will have the default default color value chosen by %GeometryPath.\n     @see setDefaultColor() **/\n-    SimTK::Vec3 getColor(const SimTK::State& s) const;\n-\n-    double getLength( const SimTK::State& s) const;\n-    void setLength( const SimTK::State& s, double length) const;\n-    double getPreScaleLength( const SimTK::State& s) const;\n-    void setPreScaleLength( const SimTK::State& s, double preScaleLength);\n-    const Array<PathPoint*>& getCurrentPath( const SimTK::State& s) const;\n-\n-    const Array<PathPoint*>& getCurrentDisplayPath(const SimTK::State& s) const;\n-\n-    double getLengtheningSpeed(const SimTK::State& s) const;\n-    void setLengtheningSpeed( const SimTK::State& s, double speed ) const;\n-\n-    /** get the the path as PointForceDirections directions, which can be used\n-        to apply tension to bodies the points are connected to.*/\n-    void getPointForceDirections(const SimTK::State& s, \n-        OpenSim::Array<PointForceDirection*> *rPFDs) const;\n-\n-    /** add in the equivalent body and generalized forces to be applied to the \n-        multibody system resulting from a tension along the GeometryPath \n-    @param state    state used to evaluate forces\n-    @param[in]  tension      scalar (double) of the applied (+ve) tensile force \n-    @param[in,out] bodyForces   Vector of SpatialVec\'s (torque, force) on bodies\n-    @param[in,out] mobilityForces  Vector of generalized forces, one per mobility   \n-    */\n-    void addInEquivalentForces(const SimTK::State& state,\n-                               const double& tension, \n-                               SimTK::Vector_<SimTK::SpatialVec>& bodyForces,\n-                               SimTK::Vector& mobilityForces) const;\n-\n-\n-    //--------------------------------------------------------------------------\n-    // COMPUTATIONS\n-    //--------------------------------------------------------------------------\n-    virtual double computeMomentArm(const SimTK::State& s, const Coordinate& aCoord) const;\n-\n-    //--------------------------------------------------------------------------\n-    // SCALING\n-    //--------------------------------------------------------------------------\n-    void preScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-    void scale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-    void postScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-\n-    //--------------------------------------------------------------------------\n-    // Visible Object Support\n-    //--------------------------------------------------------------------------\n-    virtual const VisibleObject* getDisplayer() const { \n-        return &get_display(); \n-    }\n-    \n-    void updateDisplayer(const SimTK::State& s) const override;\n+\tSimTK::Vec3 getColor(const SimTK::State& s) const;\n+\n+\tdouble getLength( const SimTK::State& s) const;\n+\tvoid setLength( const SimTK::State& s, double length) const;\n+\tdouble getPreScaleLength( const SimTK::State& s) const;\n+\tvoid setPreScaleLength( const SimTK::State& s, double preScaleLength);\n+\tconst Array<PathPoint*>& getCurrentPath( const SimTK::State& s) const;\n+\n+\tconst Array<PathPoint*>& getCurrentDisplayPath(const SimTK::State& s) const;\n+\n+\tdouble getLengtheningSpeed(const SimTK::State& s) const;\n+\tvoid setLengtheningSpeed( const SimTK::State& s, double speed ) const;\n+\n+\t/** get the the path as PointForceDirections directions, which can be used\n+\t    to apply tension to bodies the points are connected to.*/\n+\tvoid getPointForceDirections(const SimTK::State& s, \n+\t\tOpenSim::Array<PointForceDirection*> *rPFDs) const;\n+\n+\t/** add in the equivalent body and generalized forces to be applied to the \n+\t    multibody system resulting from a tension along the GeometryPath \n+\t@param state\tstate used to evaluate forces\n+\t@param[in]  tension      scalar (double) of the applied (+ve) tensile force \n+\t@param[in,out] bodyForces   Vector of SpatialVec\'s (torque, force) on bodies\n+\t@param[in,out] mobilityForces  Vector of generalized forces, one per mobility   \n+\t*/\n+\tvoid addInEquivalentForces(const SimTK::State& state,\n+\t\t\t\t\t\t\t   const double& tension, \n+\t\t\t\t\t\t       SimTK::Vector_<SimTK::SpatialVec>& bodyForces,\n+\t\t\t\t\t\t\t   SimTK::Vector& mobilityForces) const;\n+\n+\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATIONS\n+\t//--------------------------------------------------------------------------\n+\tvirtual double computeMomentArm(const SimTK::State& s, const Coordinate& aCoord) const;\n+\n+\t//--------------------------------------------------------------------------\n+\t// SCALING\n+\t//--------------------------------------------------------------------------\n+\tvoid preScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\tvoid scale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\tvoid postScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\n+\t//--------------------------------------------------------------------------\n+\t// Visible Object Support\n+\t//--------------------------------------------------------------------------\n+\t\n+\tvoid updateDisplayer(const SimTK::State& s) const override;\n \n     // Update the geometry attached to the path (location of path points and connecting segments\n-    //  all in global/interial frame)\n-    virtual void updateGeometry(const SimTK::State& s) const;\n+\t//  all in global/interial frame)\n+\tvirtual void updateGeometry(const SimTK::State& s) const;\n \n protected:\n     // ModelComponent interface.\n@@ -199,37 +193,37 @@ protected:\n     void extendInitStateFromProperties(SimTK::State& s) const override;\n     void extendAddToSystem(SimTK::MultibodySystem& system) const override;\n \n-    // Visual support GeometryPath drawing in SimTK visualizer.\n-    void generateDecorations(\n-            bool                                        fixed,\n-            const ModelDisplayHints&                    hints,\n-            const SimTK::State&                         state,\n-            SimTK::Array_<SimTK::DecorativeGeometry>&   appendToThis) const\n+\t// Visual support GeometryPath drawing in SimTK visualizer.\n+\tvoid generateDecorations(\n+\t\t\tbool \t\t\t\t\t\t\t\t\t    fixed,\n+\t\t\tconst ModelDisplayHints&\t\t\t\t    hints,\n+\t\t\tconst SimTK::State&\t\t\t\t\t\t    state,\n+\t\t\tSimTK::Array_<SimTK::DecorativeGeometry>&\tappendToThis) const\n             override;\n \n private:\n \n-    void computePath(const SimTK::State& s ) const;\n-    void computeLengtheningSpeed(const SimTK::State& s) const;\n-    void applyWrapObjects(const SimTK::State& s, Array<PathPoint*>& path ) const;\n-    double calcPathLengthChange(const SimTK::State& s, const WrapObject& wo, \n+\tvoid computePath(const SimTK::State& s ) const;\n+\tvoid computeLengtheningSpeed(const SimTK::State& s) const;\n+\tvoid applyWrapObjects(const SimTK::State& s, Array<PathPoint*>& path ) const;\n+\tdouble calcPathLengthChange(const SimTK::State& s, const WrapObject& wo, \n                                 const WrapResult& wr, \n                                 const Array<PathPoint*>& path) const; \n-    double calcLengthAfterPathComputation\n+\tdouble calcLengthAfterPathComputation\n        (const SimTK::State& s, const Array<PathPoint*>& currentPath) const;\n \n \n-    void setNull();\n-    void constructProperties();\n-    void updateDisplayPath(const SimTK::State& s) const;\n-    void updateGeometrySize(const SimTK::State& ) const;\n-    void updateGeometryLocations(const SimTK::State& s) const;\n-    void namePathPoints(int aStartingIndex);\n+\tvoid setNull();\n+\tvoid constructProperties();\n+\tvoid updateDisplayPath(const SimTK::State& s) const;\n+\tvoid updateGeometrySize(const SimTK::State& ) const;\n+\tvoid updateGeometryLocations(const SimTK::State& s) const;\n+\tvoid namePathPoints(int aStartingIndex);\n     void placeNewPathPoint(const SimTK::State& s, SimTK::Vec3& aOffset, \n                            int aIndex, const PhysicalFrame& aBody);\n \n //=============================================================================\n-};  // END of class GeometryPath\n+};\t// END of class GeometryPath\n //=============================================================================\n //=============================================================================\n \ndiff --git a/OpenSim/Simulation/Model/Ligament.cpp b/OpenSim/Simulation/Model/Ligament.cpp\nindex a846a8d95..9691e70fb 100644\n--- a/OpenSim/Simulation/Model/Ligament.cpp\n+++ b/OpenSim/Simulation/Model/Ligament.cpp\n@@ -45,7 +45,7 @@ static const Vec3 DefaultLigamentColor(.9,.9,.9); // mostly white\n // Default constructor.\n Ligament::Ligament()\n {\n-    constructProperties();\n+\tconstructProperties();\n }\n \n //_____________________________________________________________________________\n@@ -62,18 +62,18 @@ Ligament::Ligament()\n  */\n void Ligament::constructProperties()\n {\n-    setAuthors("Peter Loan");\n-    constructProperty_GeometryPath(GeometryPath());\n-    constructProperty_resting_length(0.0);\n-    constructProperty_pcsa_force(0.0);\n-\n-    int forceLengthCurvePoints = 13;\n-    double forceLengthCurveX[] = {-5.00000000,  0.99800000,  0.99900000,  1.00000000,  1.10000000,  1.20000000,  1.30000000,  1.40000000,  1.50000000,  1.60000000,  1.60100000,  1.60200000,  5.00000000};\n-    double forceLengthCurveY[] = {0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.03500000,  0.12000000,  0.26000000,  0.55000000,  1.17000000,  2.00000000,  2.00000000,  2.00000000,  2.00000000};\n-    SimmSpline forceLengthCurve\n+\tsetAuthors("Peter Loan");\n+\tconstructProperty_GeometryPath(GeometryPath());\n+\tconstructProperty_resting_length(0.0);\n+\tconstructProperty_pcsa_force(0.0);\n+\n+\tint forceLengthCurvePoints = 13;\n+\tdouble forceLengthCurveX[] = {-5.00000000,  0.99800000,  0.99900000,  1.00000000,  1.10000000,  1.20000000,  1.30000000,  1.40000000,  1.50000000,  1.60000000,  1.60100000,  1.60200000,  5.00000000};\n+\tdouble forceLengthCurveY[] = {0.00000000,  0.00000000,  0.00000000,  0.00000000,  0.03500000,  0.12000000,  0.26000000,  0.55000000,  1.17000000,  2.00000000,  2.00000000,  2.00000000,  2.00000000};\n+\tSimmSpline forceLengthCurve\n        (forceLengthCurvePoints, forceLengthCurveX, forceLengthCurveY);\n \n-    constructProperty_force_length_curve(forceLengthCurve);\n+\tconstructProperty_force_length_curve(forceLengthCurve);\n }\n \n \n@@ -84,10 +84,10 @@ void Ligament::extendFinalizeFromProperties()\n     // Resting length must be greater than 0.0.\n     assert(get_resting_length() > 0.0);\n \n-    GeometryPath& path = upd_GeometryPath();\n+\tGeometryPath& path = upd_GeometryPath();\n     path.setDefaultColor(DefaultLigamentColor);\n-    addComponent(&path);\n-    path.setOwner(this);\n+\taddComponent(&path);\n+\tpath.setOwner(this);\n }\n \n \n@@ -98,11 +98,11 @@ void Ligament::extendFinalizeFromProperties()\n void Ligament::extendRealizeDynamics(const SimTK::State& state) const {\n     Super::extendRealizeDynamics(state); // Mandatory first line\n \n-    if(!isDisabled(state)){\n-        const SimTK::Vec3 color = computePathColor(state);\n-        if (!color.isNaN())\n-            getGeometryPath().setColor(state, color);\n-    }\n+\tif(!isDisabled(state)){\n+\t\tconst SimTK::Vec3 color = computePathColor(state);\n+\t\tif (!color.isNaN())\n+\t\t\tgetGeometryPath().setColor(state, color);\n+\t}\n }\n \n //------------------------------------------------------------------------------\n@@ -125,9 +125,9 @@ SimTK::Vec3 Ligament::computePathColor(const SimTK::State& state) const {\n  void Ligament::extendAddToSystem(SimTK::MultibodySystem& system) const\n {\n     Super::extendAddToSystem(system);\n-    // Cache the computed tension and strain of the ligament\n-    addCacheVariable<double>("tension", 0.0, SimTK::Stage::Velocity);\n-    addCacheVariable<double>("strain", 0.0, SimTK::Stage::Velocity);\n+\t// Cache the computed tension and strain of the ligament\n+\taddCacheVariable<double>("tension", 0.0, SimTK::Stage::Velocity);\n+\taddCacheVariable<double>("strain", 0.0, SimTK::Stage::Velocity);\n }\n \n \n@@ -146,7 +146,7 @@ SimTK::Vec3 Ligament::computePathColor(const SimTK::State& state) const {\n  */\n double Ligament::getLength(const SimTK::State& s) const\n {\n-    return getGeometryPath().getLength(s);\n+\treturn getGeometryPath().getLength(s);\n }\n \n //_____________________________________________________________________________\n@@ -158,8 +158,8 @@ double Ligament::getLength(const SimTK::State& s) const\n  */\n bool Ligament::setRestingLength(double aRestingLength)\n {\n-    set_resting_length(aRestingLength);\n-    return true;\n+\tset_resting_length(aRestingLength);\n+\treturn true;\n }\n \n //_____________________________________________________________________________\n@@ -171,8 +171,8 @@ bool Ligament::setRestingLength(double aRestingLength)\n  */\n bool Ligament::setMaxIsometricForce(double aMaxIsometricForce)\n {\n-    set_pcsa_force(aMaxIsometricForce);\n-    return true;\n+\tset_pcsa_force(aMaxIsometricForce);\n+\treturn true;\n }\n \n //_____________________________________________________________________________\n@@ -184,8 +184,8 @@ bool Ligament::setMaxIsometricForce(double aMaxIsometricForce)\n  */\n bool Ligament::setForceLengthCurve(const Function& aForceLengthCurve)\n {\n-    set_force_length_curve(aForceLengthCurve);\n-    return true;\n+\tset_force_length_curve(aForceLengthCurve);\n+\treturn true;\n }\n //=============================================================================\n // SCALING\n@@ -200,7 +200,7 @@ bool Ligament::setForceLengthCurve(const Function& aForceLengthCurve)\n  */\n void Ligament::preScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().preScale(s, aScaleSet);\n+\tupdGeometryPath().preScale(s, aScaleSet);\n }\n \n //_____________________________________________________________________________\n@@ -212,7 +212,7 @@ void Ligament::preScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n  */\n void Ligament::scale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().scale(s, aScaleSet);\n+\tupdGeometryPath().scale(s, aScaleSet);\n }\n \n //_____________________________________________________________________________\n@@ -225,21 +225,21 @@ void Ligament::scale(const SimTK::State& s, const ScaleSet& aScaleSet)\n  */\n void Ligament::postScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    GeometryPath& path          = updGeometryPath();\n-    double&       restingLength = upd_resting_length();\n+\tGeometryPath& path          = updGeometryPath();\n+\tdouble&       restingLength = upd_resting_length();\n \n-    path.postScale(s, aScaleSet);\n+\tpath.postScale(s, aScaleSet);\n \n-    if (path.getPreScaleLength(s) > 0.0)\n-    {\n-        double scaleFactor = path.getLength(s) / path.getPreScaleLength(s);\n+\tif (path.getPreScaleLength(s) > 0.0)\n+\t{\n+\t\tdouble scaleFactor = path.getLength(s) / path.getPreScaleLength(s);\n \n-        // Scale resting length by the same amount as the change in\n-        // total ligament length (in the current body position).\n-        restingLength *= scaleFactor;\n+\t\t// Scale resting length by the same amount as the change in\n+\t\t// total ligament length (in the current body position).\n+\t\trestingLength *= scaleFactor;\n \n-        path.setPreScaleLength(s, 0.0);\n-    }\n+\t\tpath.setPreScaleLength(s, 0.0);\n+\t}\n }\n \n const double& Ligament::getTension(const SimTK::State& s) const\n@@ -256,56 +256,51 @@ const double& Ligament::getTension(const SimTK::State& s) const\n  */\n double Ligament::computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const\n {\n-    return getGeometryPath().computeMomentArm(s, aCoord);\n+\treturn getGeometryPath().computeMomentArm(s, aCoord);\n }\n \n \n \n void Ligament::computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const\n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const\n {\n-    const GeometryPath& path = getGeometryPath();\n-    const double& restingLength = get_resting_length();\n-    const double& pcsaForce = get_pcsa_force();\n+\tconst GeometryPath& path = getGeometryPath();\n+\tconst double& restingLength = get_resting_length();\n+\tconst double& pcsaForce = get_pcsa_force();\n \n-    double force = 0;\n+\tdouble force = 0;\n \n-    if (path.getLength(s) <= restingLength){\n+\tif (path.getLength(s) <= restingLength){\n         setCacheVariableValue<double>(s, "tension", force);\n-        return;\n-    }\n-    \n-    // evaluate normalized tendon force length curve\n-    force = getForceLengthCurve().calcValue(\n-        SimTK::Vector(1, path.getLength(s)/restingLength))* pcsaForce;\n+\t\treturn;\n+\t}\n+\t\n+\t// evaluate normalized tendon force length curve\n+\tforce = getForceLengthCurve().calcValue(\n+\t\tSimTK::Vector(1, path.getLength(s)/restingLength))* pcsaForce;\n     setCacheVariableValue<double>(s, "tension", force);\n \n-    OpenSim::Array<PointForceDirection*> PFDs;\n-    path.getPointForceDirections(s, &PFDs);\n+\tOpenSim::Array<PointForceDirection*> PFDs;\n+\tpath.getPointForceDirections(s, &PFDs);\n \n-    for (int i=0; i < PFDs.getSize(); i++) {\n-        applyForceToPoint(s, PFDs[i]->body(), PFDs[i]->point(), \n+\tfor (int i=0; i < PFDs.getSize(); i++) {\n+\t\tapplyForceToPoint(s, PFDs[i]->body(), PFDs[i]->point(), \n                           force*PFDs[i]->direction(), bodyForces);\n-    }\n-    for(int i=0; i < PFDs.getSize(); i++)\n-        delete PFDs[i];\n+\t}\n+\tfor(int i=0; i < PFDs.getSize(); i++)\n+\t\tdelete PFDs[i];\n }\n \n //_____________________________________________________________________________\n /**\n  * Get the visible object used to represent the Ligament.\n  */\n-const VisibleObject* Ligament::getDisplayer() const\n-{ \n-    return getGeometryPath().getDisplayer(); \n-}\n-\n //_____________________________________________________________________________\n /**\n  * Update the visible object used to represent the Ligament.\n  */\n void Ligament::updateDisplayer(const SimTK::State& s) const\n {\n-    getGeometryPath().updateDisplayer(s);\n+\tgetGeometryPath().updateDisplayer(s);\n }\ndiff --git a/OpenSim/Simulation/Model/Ligament.h b/OpenSim/Simulation/Model/Ligament.h\nindex 72ed1331d..9ca97fa9b 100644\n--- a/OpenSim/Simulation/Model/Ligament.h\n+++ b/OpenSim/Simulation/Model/Ligament.h\n@@ -32,10 +32,10 @@\n #include "Force.h"\n \n #ifdef SWIG\n-    #ifdef OSIMACTUATORS_API\n-        #undef OSIMACTUATORS_API\n-        #define OSIMACTUATORS_API\n-    #endif\n+\t#ifdef OSIMACTUATORS_API\n+\t\t#undef OSIMACTUATORS_API\n+\t\t#define OSIMACTUATORS_API\n+\t#endif\n #endif\n \n namespace OpenSim {\n@@ -57,68 +57,67 @@ public:\n     /** @name Property declarations\n     These are the serializable properties associated with this class. **/\n     /**@{**/    OpenSim_DECLARE_UNNAMED_PROPERTY(GeometryPath, \n-        "the set of points defining the path of the ligament");\n+\t\t"the set of points defining the path of the ligament");\n     OpenSim_DECLARE_PROPERTY(resting_length, double,\n-        "resting length of the ligament");\n-    OpenSim_DECLARE_PROPERTY(pcsa_force, double,\n-        "force magnitude that scales the force-length curve");\n-    OpenSim_DECLARE_PROPERTY(force_length_curve, Function,\n-        "Function representing the force-length behavior of the ligament");\n+\t\t"resting length of the ligament");\n+\tOpenSim_DECLARE_PROPERTY(pcsa_force, double,\n+\t\t"force magnitude that scales the force-length curve");\n+\tOpenSim_DECLARE_PROPERTY(force_length_curve, Function,\n+\t\t"Function representing the force-length behavior of the ligament");\n     /**@}**/\n \n \n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    Ligament();\n+\tLigament();\n \n     // Uses default (compiler-generated) destructor, copy constructor, and copy\n     // assignment operator.\n \n-    //--------------------------------------------------------------------------\n-    // GET\n-    //--------------------------------------------------------------------------\n-    // Properties\n-    const GeometryPath& getGeometryPath() const \n+\t//--------------------------------------------------------------------------\n+\t// GET\n+\t//--------------------------------------------------------------------------\n+\t// Properties\n+\tconst GeometryPath& getGeometryPath() const \n     {   return get_GeometryPath(); }\n-    GeometryPath& updGeometryPath() \n+\tGeometryPath& updGeometryPath() \n     {   return upd_GeometryPath(); }\n-    virtual bool hasGeometryPath() const { return true;};\n-    virtual double getLength(const SimTK::State& s) const;\n-    virtual double getRestingLength() const \n+\tvirtual bool hasGeometryPath() const { return true;};\n+\tvirtual double getLength(const SimTK::State& s) const;\n+\tvirtual double getRestingLength() const \n     {   return get_resting_length(); }\n-    virtual bool setRestingLength(double aRestingLength);\n-    virtual double getMaxIsometricForce() const \n+\tvirtual bool setRestingLength(double aRestingLength);\n+\tvirtual double getMaxIsometricForce() const \n     {   return get_pcsa_force(); }\n-    virtual bool setMaxIsometricForce(double aMaxIsometricForce);\n-    virtual const Function& getForceLengthCurve() const \n+\tvirtual bool setMaxIsometricForce(double aMaxIsometricForce);\n+\tvirtual const Function& getForceLengthCurve() const \n     {   return get_force_length_curve(); }\n-    virtual bool setForceLengthCurve(const Function& aForceLengthCurve);\n+\tvirtual bool setForceLengthCurve(const Function& aForceLengthCurve);\n \n-    // computed variables\n-    const double& getTension(const SimTK::State& s) const;\n+\t// computed variables\n+\tconst double& getTension(const SimTK::State& s) const;\n \n-    //--------------------------------------------------------------------------\n-    // COMPUTATIONS\n-    //--------------------------------------------------------------------------\n-    virtual double computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const;\n-    virtual void computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const;\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATIONS\n+\t//--------------------------------------------------------------------------\n+\tvirtual double computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const;\n+\tvirtual void computeForce(const SimTK::State& s, \n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const;\n \n-    //--------------------------------------------------------------------------\n-    // SCALE\n-    //--------------------------------------------------------------------------\n-    virtual void preScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-    virtual void scale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-    virtual void postScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\t//--------------------------------------------------------------------------\n+\t// SCALE\n+\t//--------------------------------------------------------------------------\n+\tvirtual void preScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\tvirtual void scale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\tvirtual void postScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n \n \n-    //--------------------------------------------------------------------------\n-    // Display\n-    //--------------------------------------------------------------------------\n-    virtual const VisibleObject* getDisplayer() const;\n-    virtual void updateDisplayer(const SimTK::State& s) const;\n+\t//--------------------------------------------------------------------------\n+\t// Display\n+\t//--------------------------------------------------------------------------\n+\tvirtual void updateDisplayer(const SimTK::State& s) const;\n \n protected:\n     /** Override this method if you would like to calculate a color for use\n@@ -148,32 +147,32 @@ protected:\n     /** Extension of parent class method; derived classes may extend further. **/\n     void extendRealizeDynamics(const SimTK::State& state) const override;\n \n-    //Force reporting\n-    /** \n-     * Methods to query a Force for the value actually applied during simulation\n-     * The names of the quantities (column labels) is returned by this first function\n-     * getRecordLabels()\n-     */\n-    OpenSim::Array<std::string> getRecordLabels() const {\n-        OpenSim::Array<std::string> labels("");\n-        labels.append(getName());\n-        return labels;\n-    }\n-    /**\n-     * Given SimTK::State object extract all the values necessary to report forces, application location\n-     * frame, etc. used in conjunction with getRecordLabels and should return same size Array\n-     */\n-    OpenSim::Array<double> getRecordValues(const SimTK::State& state) const {\n-        OpenSim::Array<double> values(1);\n-        values.append(getTension(state));\n-        return values;\n-    }\n+\t//Force reporting\n+\t/** \n+\t * Methods to query a Force for the value actually applied during simulation\n+\t * The names of the quantities (column labels) is returned by this first function\n+\t * getRecordLabels()\n+\t */\n+\tOpenSim::Array<std::string> getRecordLabels() const {\n+\t\tOpenSim::Array<std::string> labels("");\n+\t\tlabels.append(getName());\n+\t\treturn labels;\n+\t}\n+\t/**\n+\t * Given SimTK::State object extract all the values necessary to report forces, application location\n+\t * frame, etc. used in conjunction with getRecordLabels and should return same size Array\n+\t */\n+\tOpenSim::Array<double> getRecordValues(const SimTK::State& state) const {\n+\t\tOpenSim::Array<double> values(1);\n+\t\tvalues.append(getTension(state));\n+\t\treturn values;\n+\t}\n \n private:\n-    void constructProperties();\n+\tvoid constructProperties();\n \n //=============================================================================\n-};  // END of class Ligament\n+};\t// END of class Ligament\n //=============================================================================\n //=============================================================================\n } // end of namespace OpenSim\ndiff --git a/OpenSim/Simulation/Model/Marker.h b/OpenSim/Simulation/Model/Marker.h\nindex 945ec51f7..01cf4c24c 100644\n--- a/OpenSim/Simulation/Model/Marker.h\n+++ b/OpenSim/Simulation/Model/Marker.h\n@@ -35,7 +35,6 @@ namespace OpenSim {\n \n class Body;\n class Model;\n-class VisibleObject;\n \n \n //=============================================================================\ndiff --git a/OpenSim/Simulation/Model/ModelVisualizer.cpp b/OpenSim/Simulation/Model/ModelVisualizer.cpp\nindex 8e064a9ac..0de990936 100644\n--- a/OpenSim/Simulation/Model/ModelVisualizer.cpp\n+++ b/OpenSim/Simulation/Model/ModelVisualizer.cpp\n@@ -385,6 +385,7 @@ void ModelVisualizer::collectFixedGeometry(const State& state) const {\n     for (int i=0; i < bodies.getSize(); ++i) {\n         const Body& body = bodies[i];\n         const MobilizedBodyIndex bx = body.getMobilizedBodyIndex();\n+        /*\n         const VisibleObject& visible = *body.getDisplayer();\n         Vec3 scale; visible.getScaleFactors(scale);\n         const Transform X_BV = visible.getTransform();\n@@ -458,7 +459,7 @@ void ModelVisualizer::collectFixedGeometry(const State& state) const {\n                                         .elementwiseMultiply(scale);\n             dmesh.setScaleFactors(netScale); \n             _viz->addDecoration(bx, X_BV*geo.getTransform(), dmesh);\n-        }\n+        }*/\n     }\n \n     // Collect any fixed geometry from the ModelComponents.\ndiff --git a/OpenSim/Simulation/Model/MovingPathPoint.h b/OpenSim/Simulation/Model/MovingPathPoint.h\nindex f05c67475..c9ce92b68 100644\n--- a/OpenSim/Simulation/Model/MovingPathPoint.h\n+++ b/OpenSim/Simulation/Model/MovingPathPoint.h\n@@ -29,7 +29,6 @@\n #include <string>\n #include <math.h>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyObjPtr.h>\n #include <OpenSim/Common/PropertyStr.h>\n #include <OpenSim/Common/Storage.h>\ndiff --git a/OpenSim/Simulation/Model/PathActuator.cpp b/OpenSim/Simulation/Model/PathActuator.cpp\nindex 103cc7284..622db7a50 100644\n--- a/OpenSim/Simulation/Model/PathActuator.cpp\n+++ b/OpenSim/Simulation/Model/PathActuator.cpp\n@@ -42,9 +42,9 @@ using namespace std;\n  */\n PathActuator::PathActuator()\n {\n-    setNull();\n+\tsetNull();\n     constructProperties();\n-    finalizeFromProperties();\n+\tfinalizeFromProperties();\n }\n \n //=============================================================================\n@@ -56,7 +56,7 @@ PathActuator::PathActuator()\n  */\n void PathActuator::setNull()\n {\n-    setAuthors("Ajay Seth");\n+\tsetAuthors("Ajay Seth");\n }\n \n //_____________________________________________________________________________\n@@ -65,8 +65,8 @@ void PathActuator::setNull()\n  */\n void PathActuator::constructProperties()\n {\n-    constructProperty_GeometryPath(GeometryPath());\n-    constructProperty_optimal_force(1.0);\n+\tconstructProperty_GeometryPath(GeometryPath());\n+\tconstructProperty_optimal_force(1.0);\n }\n \n \n@@ -84,7 +84,7 @@ void PathActuator::constructProperties()\n  */\n void PathActuator::setOptimalForce(double aOptimalForce)\n {\n-    set_optimal_force(aOptimalForce);\n+\tset_optimal_force(aOptimalForce);\n }\n \n //_____________________________________________________________________________\n@@ -95,7 +95,7 @@ void PathActuator::setOptimalForce(double aOptimalForce)\n  */\n double PathActuator::getOptimalForce() const\n {\n-    return get_optimal_force();\n+\treturn get_optimal_force();\n }\n \n //-----------------------------------------------------------------------------\n@@ -110,7 +110,7 @@ double PathActuator::getOptimalForce() const\n  */\n double PathActuator::getLength(const SimTK::State& s) const\n {\n-    return getGeometryPath().getLength(s);\n+\treturn getGeometryPath().getLength(s);\n }\n //_____________________________________________________________________________\n /**\n@@ -120,7 +120,7 @@ double PathActuator::getLength(const SimTK::State& s) const\n  */\n double PathActuator::getLengtheningSpeed(const SimTK::State& s) const\n {\n-    return getGeometryPath().getLengtheningSpeed(s);\n+\treturn getGeometryPath().getLengtheningSpeed(s);\n }\n //_____________________________________________________________________________\n /**\n@@ -141,16 +141,16 @@ double PathActuator::getStress( const SimTK::State& s) const\n  *\n  */\n void PathActuator::addNewPathPoint(\n-         const std::string& proposedName, \n+\t\t const std::string& proposedName, \n          PhysicalFrame& aBody, \n-         const SimTK::Vec3& aPositionOnBody) {\n-    // Create new PathPoint\n-    PathPoint* newPathPoint = updGeometryPath()\n+\t\t const SimTK::Vec3& aPositionOnBody) {\n+\t// Create new PathPoint\n+\tPathPoint* newPathPoint = updGeometryPath()\n         .appendNewPathPoint(proposedName, aBody, aPositionOnBody);\n-    // Set offset/position on owner body\n-    newPathPoint->setName(proposedName);\n-    for (int i=0; i<3; i++) // Use interface that does not depend on state\n-        newPathPoint->setLocationCoord(i, aPositionOnBody[i]);\n+\t// Set offset/position on owner body\n+\tnewPathPoint->setName(proposedName);\n+\tfor (int i=0; i<3; i++)\t// Use interface that does not depend on state\n+\t\tnewPathPoint->setLocationCoord(i, aPositionOnBody[i]);\n }\n \n //=============================================================================\n@@ -163,11 +163,11 @@ void PathActuator::addNewPathPoint(\n  */\n double PathActuator::computeActuation( const SimTK::State& s ) const\n {\n-    if(!_model)\n-        return 0.0;\n+\tif(!_model)\n+\t\treturn 0.0;\n \n-    // FORCE\n-    return( getControl(s) * get_optimal_force() );\n+\t// FORCE\n+\treturn( getControl(s) * get_optimal_force() );\n }\n \n \n@@ -179,31 +179,31 @@ double PathActuator::computeActuation( const SimTK::State& s ) const\n  * Apply the actuator force along path wrapping over and connecting rigid bodies\n  */\n void PathActuator::computeForce( const SimTK::State& s, \n-                               SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                               SimTK::Vector& mobilityForces) const\n+\t\t\t\t\t\t\t   SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t   SimTK::Vector& mobilityForces) const\n {\n-    if(!_model) return;\n+\tif(!_model) return;\n \n-    const GeometryPath &path = getGeometryPath();\n+\tconst GeometryPath &path = getGeometryPath();\n \n-    // compute path\'s lengthening speed if necessary\n-    double speed = path.getLengtheningSpeed(s);\n+\t// compute path\'s lengthening speed if necessary\n+\tdouble speed = path.getLengtheningSpeed(s);\n \n-    // the lengthening speed of this actutor is the "speed" of the actuator \n+\t// the lengthening speed of this actutor is the "speed" of the actuator \n     // used to compute power\n-    setSpeed(s, speed);\n+\tsetSpeed(s, speed);\n \n-    double force =0;\n+\tdouble force =0;\n     if( isActuationOverriden(s) ) {\n         force = computeOverrideActuation(s);\n-    } else {\n-        force = computeActuation(s);\n-    }\n+\t} else {\n+\t\tforce = computeActuation(s);\n+\t}\n \n-    // the force of this actuator used to compute power\n+\t// the force of this actuator used to compute power\n     setActuation(s, force);\n \n-    path.addInEquivalentForces(s, force, bodyForces, mobilityForces);\n+\tpath.addInEquivalentForces(s, force, bodyForces, mobilityForces);\n }\n \n /**\n@@ -211,7 +211,7 @@ void PathActuator::computeForce( const SimTK::State& s,\n  */\n double PathActuator::computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const\n {\n-    return getGeometryPath().computeMomentArm(s, aCoord);\n+\treturn getGeometryPath().computeMomentArm(s, aCoord);\n }\n \n //------------------------------------------------------------------------------\n@@ -225,13 +225,13 @@ double PathActuator::computeMomentArm(const SimTK::State& s, Coordinate& aCoord)\n  */\n void PathActuator::extendFinalizeFromProperties()\n {\n-    GeometryPath &path = updGeometryPath();\n+\tGeometryPath &path = updGeometryPath();\n \n-    clearComponents();\n-    addComponent(&path);\n+\tclearComponents();\n+\taddComponent(&path);\n \n-    // Set owner here in case errors happen later so we can put useful message about responsible party.\n-    path.setOwner(this);\n+\t// Set owner here in case errors happen later so we can put useful message about responsible party.\n+\tpath.setOwner(this);\n \n     Super::extendFinalizeFromProperties();\n }\n@@ -244,13 +244,13 @@ void PathActuator::extendRealizeDynamics(const SimTK::State& state) const\n {\n     Super::extendRealizeDynamics(state); // Mandatory first line\n \n-    // if this force is disabled OR it is being overidden (not computing dynamics)\n-    // then don\'t compute the color of the path.\n+\t// if this force is disabled OR it is being overidden (not computing dynamics)\n+\t// then don\'t compute the color of the path.\n     if (!isDisabled(state) && !isActuationOverriden(state)){\n-        const SimTK::Vec3 color = computePathColor(state);\n-        if (!color.isNaN())\n-            getGeometryPath().setColor(state, color);\n-    }\n+\t\tconst SimTK::Vec3 color = computePathColor(state);\n+\t\tif (!color.isNaN())\n+\t\t\tgetGeometryPath().setColor(state, color);\n+\t}\n }\n \n //------------------------------------------------------------------------------\n@@ -283,18 +283,9 @@ SimTK::Vec3 PathActuator::computePathColor(const SimTK::State& state) const {\n  */\n void PathActuator::updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber)\n {\n-    updGeometryPath().setOwner(this);\n-    Super::updateFromXMLNode(aNode, versionNumber);\n-}   \n-\n-//_____________________________________________________________________________\n-/**\n- * Get the visible object used to represent the muscle.\n- */\n-const VisibleObject* PathActuator::getDisplayer() const\n-{ \n-    return getGeometryPath().getDisplayer(); \n-}\n+\tupdGeometryPath().setOwner(this);\n+\tSuper::updateFromXMLNode(aNode, versionNumber);\n+}\t\n \n //_____________________________________________________________________________\n /**\n@@ -302,7 +293,7 @@ const VisibleObject* PathActuator::getDisplayer() const\n  */\n void PathActuator::updateDisplayer(const SimTK::State& s) const\n {\n-    getGeometryPath().updateDisplayer(s);\n+\tgetGeometryPath().updateDisplayer(s);\n }\n \n //=============================================================================\n@@ -318,7 +309,7 @@ void PathActuator::updateDisplayer(const SimTK::State& s) const\n  */\n void PathActuator::preScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().preScale(s, aScaleSet);\n+\tupdGeometryPath().preScale(s, aScaleSet);\n }\n \n //_____________________________________________________________________________\n@@ -330,7 +321,7 @@ void PathActuator::preScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n  */\n void PathActuator::scale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().scale(s, aScaleSet);\n+\tupdGeometryPath().scale(s, aScaleSet);\n }\n \n //_____________________________________________________________________________\n@@ -344,5 +335,5 @@ void PathActuator::scale(const SimTK::State& s, const ScaleSet& aScaleSet)\n  */\n void PathActuator::postScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().postScale(s, aScaleSet);\n+\tupdGeometryPath().postScale(s, aScaleSet);\n }\ndiff --git a/OpenSim/Simulation/Model/PathActuator.h b/OpenSim/Simulation/Model/PathActuator.h\nindex 6c59b1299..32c45c0c1 100644\n--- a/OpenSim/Simulation/Model/PathActuator.h\n+++ b/OpenSim/Simulation/Model/PathActuator.h\n@@ -54,7 +54,7 @@ public:\n     properties. **/\n     /**@{**/\n     OpenSim_DECLARE_UNNAMED_PROPERTY(GeometryPath,\n-        "The set of points defining the path of the muscle.");\n+\t\t"The set of points defining the path of the muscle.");\n     OpenSim_DECLARE_PROPERTY(optimal_force, double,\n         "The maximum force this actuator can produce.");\n     /**@}**/\n@@ -62,72 +62,71 @@ public:\n //=============================================================================\n // PUBLIC METHODS\n //=============================================================================\n-    PathActuator();\n+\tPathActuator();\n \n     // default destructor, copy constructor, copy assignment\n \n-    //--------------------------------------------------------------------------\n-    // GET AND SET\n-    //--------------------------------------------------------------------------\n-    // Path\n-    GeometryPath& updGeometryPath() { return upd_GeometryPath(); }\n-    const GeometryPath& getGeometryPath() const \n+\t//--------------------------------------------------------------------------\n+\t// GET AND SET\n+\t//--------------------------------------------------------------------------\n+\t// Path\n+\tGeometryPath& updGeometryPath() { return upd_GeometryPath(); }\n+\tconst GeometryPath& getGeometryPath() const \n     {   return get_GeometryPath(); }\n-    virtual bool hasGeometryPath() const { return true;};\n+\tvirtual bool hasGeometryPath() const { return true;};\n \n-    // OPTIMAL FORCE\n-    void setOptimalForce(double aOptimalForce);\n-    double getOptimalForce() const;\n+\t// OPTIMAL FORCE\n+\tvoid setOptimalForce(double aOptimalForce);\n+\tdouble getOptimalForce() const;\n \n-    // Length and Speed of actuator\n-    virtual double getLength(const SimTK::State& s) const;\n-    virtual double getLengtheningSpeed(const SimTK::State& s) const;\n+\t// Length and Speed of actuator\n+\tvirtual double getLength(const SimTK::State& s) const;\n+\tvirtual double getLengtheningSpeed(const SimTK::State& s) const;\n \n-    // Power: Since lengthening is positive and tension always shortens, positive power\n-    // is when muscle is shortening under tension.\n-    virtual double getPower(const SimTK::State& s) const \n+\t// Power: Since lengthening is positive and tension always shortens, positive power\n+\t// is when muscle is shortening under tension.\n+\tvirtual double getPower(const SimTK::State& s) const \n     {   return -getActuation(s)*getSpeed(s); }\n \n \n-    // STRESS\n-    virtual double getStress( const SimTK::State& s ) const;\n+\t// STRESS\n+\tvirtual double getStress( const SimTK::State& s ) const;\n \n     // Convenience method to add PathPoints\n-     /** Note that this function does not maintain the State and so should be used only\n-        before a valid State is created */\n+\t /** Note that this function does not maintain the State and so should be used only\n+\t\tbefore a valid State is created */\n     void addNewPathPoint(const std::string& proposedName, PhysicalFrame& aBody,\n-                           const SimTK::Vec3& aPositionOnBody);\n-\n-    //--------------------------------------------------------------------------\n-    // APPLICATION\n-    //--------------------------------------------------------------------------\n-    virtual void computeForce( const SimTK::State& state, \n-                               SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                               SimTK::Vector& mobilityForces) const;\n-\n-    //--------------------------------------------------------------------------\n-    // COMPUTATIONS\n-    //--------------------------------------------------------------------------\n-    virtual double computeActuation( const SimTK::State& s) const;\n-    virtual double computeMomentArm( const SimTK::State& s, Coordinate& aCoord) const;\n-\n-    //--------------------------------------------------------------------------\n-    // XML\n-    //--------------------------------------------------------------------------\n-    virtual void updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber=-1);\n-\n-    //--------------------------------------------------------------------------\n-    // SCALING\n-    //--------------------------------------------------------------------------\n-    virtual void preScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-    virtual void scale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-    virtual void postScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n-\n-    //--------------------------------------------------------------------------\n-    // Visible Object Support\n-    //--------------------------------------------------------------------------\n-    virtual const VisibleObject* getDisplayer() const;\n-    virtual void updateDisplayer(const SimTK::State& s) const;\n+\t\t\t\t\t\t   const SimTK::Vec3& aPositionOnBody);\n+\n+\t//--------------------------------------------------------------------------\n+\t// APPLICATION\n+\t//--------------------------------------------------------------------------\n+\tvirtual void computeForce( const SimTK::State& state, \n+\t\t\t\t\t\t\t   SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t   SimTK::Vector& mobilityForces) const;\n+\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATIONS\n+\t//--------------------------------------------------------------------------\n+\tvirtual double computeActuation( const SimTK::State& s) const;\n+\tvirtual double computeMomentArm( const SimTK::State& s, Coordinate& aCoord) const;\n+\n+\t//--------------------------------------------------------------------------\n+\t// XML\n+\t//--------------------------------------------------------------------------\n+\tvirtual void updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber=-1);\n+\n+\t//--------------------------------------------------------------------------\n+\t// SCALING\n+\t//--------------------------------------------------------------------------\n+\tvirtual void preScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\tvirtual void scale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\tvirtual void postScale(const SimTK::State& s, const ScaleSet& aScaleSet);\n+\n+\t//--------------------------------------------------------------------------\n+\t// Visible Object Support\n+\t//--------------------------------------------------------------------------\n+\tvirtual void updateDisplayer(const SimTK::State& s) const;\n \n protected:\n     /** Override this method if you would like to calculate a color for use when\n@@ -155,11 +154,11 @@ protected:\n     void extendRealizeDynamics(const SimTK::State& state) const override;\n \n private:\n-    void setNull();\n-    void constructProperties();\n+\tvoid setNull();\n+\tvoid constructProperties();\n \n //=============================================================================\n-};  // END of class PathActuator\n+};\t// END of class PathActuator\n \n }; //namespace\n //=============================================================================\ndiff --git a/OpenSim/Simulation/Model/PathPoint.cpp b/OpenSim/Simulation/Model/PathPoint.cpp\nindex 487379a9c..262a4ef9c 100644\n--- a/OpenSim/Simulation/Model/PathPoint.cpp\n+++ b/OpenSim/Simulation/Model/PathPoint.cpp\n@@ -31,6 +31,7 @@\n #include "GeometryPath.h"\n #include <OpenSim/Simulation/SimbodyEngine/SimbodyEngine.h> \n #include <OpenSim/Simulation/Wrap/WrapObject.h>\n+#include <OpenSim/Common/Geometry.h>\n \n //=============================================================================\n // STATICS\n@@ -38,8 +39,7 @@\n using namespace std;\n using namespace OpenSim;\n using SimTK::Vec3;\n-\n-Geometry* PathPoint::_defaultGeometry= AnalyticSphere::createSphere(0.005);\n+using SimTK::Transform;\n \n //=============================================================================\n // CONSTRUCTOR(S) AND DESTRUCTOR\n@@ -50,10 +50,10 @@ Geometry* PathPoint::_defaultGeometry= AnalyticSphere::createSphere(0.005);\n  */\n PathPoint::PathPoint() :\n    _location(_locationProp.getValueDblVec()),\n-    _bodyName(_bodyNameProp.getValueStr())\n+\t_bodyName(_bodyNameProp.getValueStr())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -73,11 +73,11 @@ PathPoint::~PathPoint()\n PathPoint::PathPoint(const PathPoint &aPoint) :\n    Object(aPoint),\n    _location(_locationProp.getValueDblVec()),\n-    _bodyName(_bodyNameProp.getValueStr())\n+\t_bodyName(_bodyNameProp.getValueStr())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aPoint);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aPoint);\n }\n \n \n@@ -92,11 +92,10 @@ PathPoint::PathPoint(const PathPoint &aPoint) :\n  */\n void PathPoint::copyData(const PathPoint &aPoint)\n {\n-    _location = aPoint._location;\n-    _displayer = aPoint._displayer;\n-    _bodyName = aPoint._bodyName;\n-    _body = aPoint._body;\n-    _path = aPoint._path;\n+\t_location = aPoint._location;\n+\t_bodyName = aPoint._bodyName;\n+\t_body = aPoint._body;\n+\t_path = aPoint._path;\n }\n \n //_____________________________________________________________________________\n@@ -107,7 +106,7 @@ void PathPoint::copyData(const PathPoint &aPoint)\n  */\n void PathPoint::init(const PathPoint& aPoint)\n {\n-    copyData(aPoint);\n+\tcopyData(aPoint);\n }\n \n //_____________________________________________________________________________\n@@ -116,8 +115,8 @@ void PathPoint::init(const PathPoint& aPoint)\n  */\n void PathPoint::setNull()\n {\n-    _body = NULL;\n-    _path = NULL;\n+\t_body = NULL;\n+\t_path = NULL;\n }\n \n //_____________________________________________________________________________\n@@ -126,14 +125,14 @@ void PathPoint::setNull()\n  */\n void PathPoint::setupProperties()\n {\n-    const SimTK::Vec3 defaultLocation(0.0);\n-    _locationProp.setName("location");\n-    _locationProp.setValue(defaultLocation);\n-    //_locationProp.setAllowableListSize(3);\n-    _propertySet.append(&_locationProp);\n-\n-    _bodyNameProp.setName("body");\n-    _propertySet.append(&_bodyNameProp);\n+\tconst SimTK::Vec3 defaultLocation(0.0);\n+\t_locationProp.setName("location");\n+\t_locationProp.setValue(defaultLocation);\n+\t//_locationProp.setAllowableListSize(3);\n+\t_propertySet.append(&_locationProp);\n+\n+\t_bodyNameProp.setName("body");\n+\t_propertySet.append(&_bodyNameProp);\n }\n \n //_____________________________________________________________________________\n@@ -143,22 +142,22 @@ void PathPoint::setupProperties()\n  */\n void PathPoint::connectToModelAndPath(const Model& aModel, GeometryPath& aPath)\n {\n-    _path = &aPath;\n-    _model  = &aModel;\n+\t_path = &aPath;\n+\t_model  = &aModel;\n \n     if (_bodyName == aModel.getGround().getName()){\n         _body = &const_cast<Model*>(&aModel)->updGround();\n         return;\n     }\n \n-    // Look up the body by name in the kinematics engine and\n-    // store a pointer to it.\n-    if (!aModel.getBodySet().contains(_bodyName))\n-    {\n-        string errorMessage = "Body " + _bodyName + " referenced in path" + aPath.getName() + " not found in model " + aModel.getName();\n-        throw Exception(errorMessage);\n-    }\n-    _body = &const_cast<Model*>(&aModel)->updBodySet().get(_bodyName);\n+\t// Look up the body by name in the kinematics engine and\n+\t// store a pointer to it.\n+\tif (!aModel.getBodySet().contains(_bodyName))\n+\t{\n+\t\tstring errorMessage = "Body " + _bodyName + " referenced in path" + aPath.getName() + " not found in model " + aModel.getName();\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\t_body = &const_cast<Model*>(&aModel)->updBodySet().get(_bodyName);\n }\n \n //_____________________________________________________________________________\n@@ -168,9 +167,9 @@ void PathPoint::connectToModelAndPath(const Model& aModel, GeometryPath& aPath)\n  */\n void PathPoint::updateGeometry()\n {\n-    Transform position;\n-    position.setP(_location);\n-    updDisplayer()->setTransform(position);\n+\tTransform position;\n+\tposition.setP(_location);\n+\t//updDisplayer()->setTransform(position);\n }\n //=============================================================================\n // OPERATORS\n@@ -183,12 +182,12 @@ void PathPoint::updateGeometry()\n  */\n PathPoint& PathPoint::operator=(const PathPoint &aPoint)\n {\n-    // BASE CLASS\n-    Object::operator=(aPoint);\n+\t// BASE CLASS\n+\tObject::operator=(aPoint);\n \n-    copyData(aPoint);\n+\tcopyData(aPoint);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //_____________________________________________________________________________\n@@ -199,11 +198,11 @@ PathPoint& PathPoint::operator=(const PathPoint &aPoint)\n  */\n void PathPoint::setBody(PhysicalFrame& aBody)\n {\n-    if (&aBody == _body)\n-        return;\n+\tif (&aBody == _body)\n+\t\treturn;\n \n-    _body = &aBody;\n-    _bodyName = aBody.getName();\n+\t_body = &aBody;\n+\t_bodyName = aBody.getName();\n }\n \n //_____________________________________________________________________________\n@@ -223,17 +222,17 @@ void PathPoint::changeBodyPreserveLocation(const SimTK::State& s, PhysicalFrame&\n     }\n     // if it is already assigned to aBody, do nothing\n     if (_body == &aBody )\n-        return;\n+\t\treturn;\n \n-    // Preserve location means to switch bodies without changing\n-    // the location of the point in the inertial reference frame.\n+\t// Preserve location means to switch bodies without changing\n+\t// the location of the point in the inertial reference frame.\n     _location = _body->findLocationInAnotherFrame(s, _location, aBody);\n     _bodyName = aBody.getName();\n \n     // now assign this point\'s body to point to aBody\n     _body = &aBody;\n \n-    connectToModelAndPath(aBody.getModel(), *getPath());\n+\tconnectToModelAndPath(aBody.getModel(), *getPath());\n }\n \n //_____________________________________________________________________________\n@@ -244,7 +243,7 @@ void PathPoint::changeBodyPreserveLocation(const SimTK::State& s, PhysicalFrame&\n  */\n void PathPoint::setLocation( const SimTK::State& s, const SimTK::Vec3& aLocation)\n {\n-    _location = aLocation;\n+\t_location = aLocation;\n }\n \n //_____________________________________________________________________________\n@@ -256,8 +255,8 @@ void PathPoint::setLocation( const SimTK::State& s, const SimTK::Vec3& aLocation\n  */\n void PathPoint::setLocation( const SimTK::State& s, int aCoordIndex, double aLocation)\n {\n-    if (aCoordIndex >= 0 && aCoordIndex <= 2)\n-        _location[aCoordIndex] = aLocation;\n+\tif (aCoordIndex >= 0 && aCoordIndex <= 2)\n+\t\t_location[aCoordIndex] = aLocation;\n }\n \n //_____________________________________________________________________________\n@@ -269,25 +268,25 @@ void PathPoint::setLocation( const SimTK::State& s, int aCoordIndex, double aLoc\n \n void PathPoint::getVelocity(const SimTK::State& s, SimTK::Vec3& aVelocity)\n {\n-    aVelocity[0] = aVelocity[1] = aVelocity[2] = 0.0;\n+\taVelocity[0] = aVelocity[1] = aVelocity[2] = 0.0;\n }\n \n PathPoint* PathPoint::makePathPointOfType(PathPoint* aPoint, const string& aNewTypeName)\n {\n-    PathPoint* newPoint = NULL;\n-\n-    if (aPoint != NULL) {\n-        Object* newObject = Object::newInstanceOfType(aNewTypeName);\n-        if (newObject) {\n-            newPoint = dynamic_cast<PathPoint*>(newObject);\n-            if (newPoint) {\n-                // Copy the contents from aPoint.\n-                newPoint->init(*aPoint);\n-            }\n-        }\n-    }\n-\n-    return newPoint;\n+\tPathPoint* newPoint = NULL;\n+\n+\tif (aPoint != NULL) {\n+\t\tObject* newObject = Object::newInstanceOfType(aNewTypeName);\n+\t\tif (newObject) {\n+\t\t\tnewPoint = dynamic_cast<PathPoint*>(newObject);\n+\t\t\tif (newPoint) {\n+\t\t\t\t// Copy the contents from aPoint.\n+\t\t\t\tnewPoint->init(*aPoint);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn newPoint;\n }\n \n //=============================================================================\n@@ -301,8 +300,8 @@ PathPoint* PathPoint::makePathPointOfType(PathPoint* aPoint, const string& aNewT\n  */\n void PathPoint::scale(const SimTK::State& s, const SimTK::Vec3& aScaleFactors)\n {\n-    for (int i = 0; i < 3; i++)\n-        _location[i] *= aScaleFactors[i];\n+\tfor (int i = 0; i < 3; i++)\n+\t\t_location[i] *= aScaleFactors[i];\n \n-    updateGeometry();\n+\tupdateGeometry();\n }\ndiff --git a/OpenSim/Simulation/Model/PathPoint.h b/OpenSim/Simulation/Model/PathPoint.h\nindex 57f5f8d0d..6a1461725 100644\n--- a/OpenSim/Simulation/Model/PathPoint.h\n+++ b/OpenSim/Simulation/Model/PathPoint.h\n@@ -26,16 +26,17 @@\n \n // INCLUDE\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n-#include <OpenSim/Common/VisibleObject.h>\n+#include <OpenSim/Common/Array.h>\n #include <OpenSim/Common/PropertyDblArray.h>\n #include <OpenSim/Common/PropertyDblVec.h>\n #include <OpenSim/Common/PropertyStr.h>\n+#include <OpenSim/Common/Object.h>\n \n #ifdef SWIG\n-    #ifdef OSIMSIMULATION_API\n-        #undef OSIMSIMULATION_API\n-        #define OSIMSIMULATION_API\n-    #endif\n+\t#ifdef OSIMSIMULATION_API\n+\t\t#undef OSIMSIMULATION_API\n+\t\t#define OSIMSIMULATION_API\n+\t#endif\n #endif\n \n namespace OpenSim {\n@@ -70,88 +71,80 @@ protected:\n    PropertyDblVec3 _locationProp;\n    SimTK::Vec3 &_location;\n \n-    PropertyStr _bodyNameProp;\n+\tPropertyStr _bodyNameProp;\n    std::string &_bodyName;\n \n-    // Support for Display\n-    VisibleObject _displayer;\n \n     /* const*/ PhysicalFrame* _body; // Not const anymore since the body\'s displayer is not const\n \n-    GeometryPath* _path; // the path that owns this location point\n-\n-    /** A temporary kluge until the default mechanism is working */\n-    static Geometry* _defaultGeometry;\n+\tGeometryPath* _path; // the path that owns this location point\n \n //=============================================================================\n // METHODS\n //=============================================================================\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// CONSTRUCTION\n+\t//--------------------------------------------------------------------------\n public:\n-    PathPoint();\n-    PathPoint(const PathPoint &aPoint);\n-    virtual ~PathPoint();\n+\tPathPoint();\n+\tPathPoint(const PathPoint &aPoint);\n+\tvirtual ~PathPoint();\n \n #ifndef SWIG\n-    PathPoint& operator=(const PathPoint &aPoint);\n+\tPathPoint& operator=(const PathPoint &aPoint);\n #endif\n    void copyData(const PathPoint &aPoint);\n-    virtual void init(const PathPoint& aPoint);\n+\tvirtual void init(const PathPoint& aPoint);\n \n #ifndef SWIG\n-    const SimTK::Vec3& getLocation() const { return _location; }\n+\tconst SimTK::Vec3& getLocation() const { return _location; }\n #endif\n-    SimTK::Vec3& getLocation()  { return _location; }\n+\tSimTK::Vec3& getLocation()  { return _location; }\n \n-    const double& getLocationCoord(int aXYZ) const { assert(aXYZ>=0 && aXYZ<=2); return _location[aXYZ]; }\n-    void setLocationCoord(int aXYZ, double aValue) { assert(aXYZ>=0 && aXYZ<=2); _location[aXYZ]=aValue; }\n-    // A variant that uses basic types for use by GUI\n+\tconst double& getLocationCoord(int aXYZ) const { assert(aXYZ>=0 && aXYZ<=2); return _location[aXYZ]; }\n+\tvoid setLocationCoord(int aXYZ, double aValue) { assert(aXYZ>=0 && aXYZ<=2); _location[aXYZ]=aValue; }\n+\t// A variant that uses basic types for use by GUI\n \n-    void setLocation( const SimTK::State& s, const SimTK::Vec3& aLocation);\n-    void setLocation( const SimTK::State& s, int aCoordIndex, double aLocation);\n-    void setLocation( const SimTK::State& s, double pt[]){ // A variant that uses basic types for use by GUI\n-        setLocation(s,SimTK::Vec3::updAs(pt));\n-    }\n+\tvoid setLocation( const SimTK::State& s, const SimTK::Vec3& aLocation);\n+\tvoid setLocation( const SimTK::State& s, int aCoordIndex, double aLocation);\n+\tvoid setLocation( const SimTK::State& s, double pt[]){ // A variant that uses basic types for use by GUI\n+\t\tsetLocation(s,SimTK::Vec3::updAs(pt));\n+\t}\n     void setBody(PhysicalFrame& aBody);\n     void changeBodyPreserveLocation(const SimTK::State& s, PhysicalFrame& aBody);\n \n     PhysicalFrame& getBody() const { return *_body; }\n-    const std::string& getBodyName() const { return _bodyName; }\n-    GeometryPath* getPath() const { return _path; }\n+\tconst std::string& getBodyName() const { return _bodyName; }\n+\tGeometryPath* getPath() const { return _path; }\n \n     virtual void scale(const SimTK::State& s, const SimTK::Vec3& aScaleFactors);\n-    virtual const WrapObject* getWrapObject() const { return NULL; }\n+\tvirtual const WrapObject* getWrapObject() const { return NULL; }\n \n-    virtual bool isActive(const SimTK::State& s) const { return true; }\n-    virtual void connectToModelAndPath(const Model& aModel, GeometryPath& aPath);\n-    virtual void update(const SimTK::State& s) { }\n+\tvirtual bool isActive(const SimTK::State& s) const { return true; }\n+\tvirtual void connectToModelAndPath(const Model& aModel, GeometryPath& aPath);\n+\tvirtual void update(const SimTK::State& s) { }\n \n-    // get the relative velocity of the path point with resepct to the body\n-    // it is connected to.\n-    virtual void getVelocity(const SimTK::State& s, SimTK::Vec3& aVelocity);\n-    // get the partial of the point location w.r.t. to the coordinates (Q)\n-    // it is dependent on.\n-    virtual SimTK::Vec3 getdPointdQ(const SimTK::State& s) const\n-        { return SimTK::Vec3(0); }\n+\t// get the relative velocity of the path point with resepct to the body\n+\t// it is connected to.\n+\tvirtual void getVelocity(const SimTK::State& s, SimTK::Vec3& aVelocity);\n+\t// get the partial of the point location w.r.t. to the coordinates (Q)\n+\t// it is dependent on.\n+\tvirtual SimTK::Vec3 getdPointdQ(const SimTK::State& s) const\n+\t    { return SimTK::Vec3(0); }\n \n-    // Visible Object Support\n-    virtual const VisibleObject* getDisplayer() const { return &_displayer; }\n-    virtual VisibleObject*  updDisplayer() { return &_displayer; };\n-    virtual void updateGeometry();\n+\tvirtual void updateGeometry();\n \n-    // Utility\n-    static PathPoint* makePathPointOfType(PathPoint* aPoint, const std::string& aNewTypeName);\n-    static void deletePathPoint(PathPoint* aPoint) { if (aPoint) delete aPoint; }\n+\t// Utility\n+\tstatic PathPoint* makePathPointOfType(PathPoint* aPoint, const std::string& aNewTypeName);\n+\tstatic void deletePathPoint(PathPoint* aPoint) { if (aPoint) delete aPoint; }\n \n protected:\n \n private:\n-    void setNull();\n-    void setupProperties();\n+\tvoid setNull();\n+\tvoid setupProperties();\n //=============================================================================\n-};  // END of class PathPoint\n+};\t// END of class PathPoint\n //=============================================================================\n //=============================================================================\n \ndiff --git a/OpenSim/Simulation/Model/PathSpring.cpp b/OpenSim/Simulation/Model/PathSpring.cpp\nindex b8dee9f97..b21461011 100644\n--- a/OpenSim/Simulation/Model/PathSpring.cpp\n+++ b/OpenSim/Simulation/Model/PathSpring.cpp\n@@ -48,13 +48,13 @@ PathSpring::PathSpring()\n }\n \n PathSpring::PathSpring(const string& name, double restLength, \n-                       double stiffness, double dissipation)\n+\t\t\t\t\t   double stiffness, double dissipation)\n {\n     constructInfrastructure();\n-    setName(name);\n-    set_resting_length(restLength);\n-    set_stiffness(stiffness);\n-    set_dissipation(dissipation);\n+\tsetName(name);\n+\tset_resting_length(restLength);\n+\tset_stiffness(stiffness);\n+\tset_dissipation(dissipation);\n }\n \n //_____________________________________________________________________________\n@@ -63,18 +63,18 @@ PathSpring::PathSpring(const string& name, double restLength,\n  */\n void PathSpring::constructProperties()\n {\n-    setAuthors("Ajay Seth");\n-    constructProperty_GeometryPath(GeometryPath());\n-    constructProperty_resting_length(SimTK::NaN);\n-    constructProperty_stiffness(SimTK::NaN);\n-    constructProperty_dissipation(SimTK::NaN);\n+\tsetAuthors("Ajay Seth");\n+\tconstructProperty_GeometryPath(GeometryPath());\n+\tconstructProperty_resting_length(SimTK::NaN);\n+\tconstructProperty_stiffness(SimTK::NaN);\n+\tconstructProperty_dissipation(SimTK::NaN);\n }\n \n void PathSpring::constructOutputs()\n {\n-    constructOutput<double>("stretch", \n-           std::bind(&PathSpring::getStretch, this, std::placeholders::_1),\n-                      SimTK::Stage::Position);\n+\tconstructOutput<double>("stretch", \n+\t       std::bind(&PathSpring::getStretch, this, std::placeholders::_1),\n+\t\t\t\t      SimTK::Stage::Position);\n }\n \n //_____________________________________________________________________________\n@@ -83,7 +83,7 @@ void PathSpring::constructOutputs()\n  */\n void PathSpring::setRestingLength(double restingLength)\n {\n-    set_resting_length(restingLength);\n+\tset_resting_length(restingLength);\n }\n //_____________________________________________________________________________\n /*\n@@ -91,7 +91,7 @@ void PathSpring::setRestingLength(double restingLength)\n  */\n void PathSpring::setStiffness(double stiffness)\n {\n-    set_stiffness(stiffness);\n+\tset_stiffness(stiffness);\n }\n //_____________________________________________________________________________\n /*\n@@ -99,7 +99,7 @@ void PathSpring::setStiffness(double stiffness)\n  */\n void PathSpring::setDissipation(double dissipation)\n {\n-    set_dissipation(dissipation);\n+\tset_dissipation(dissipation);\n }\n \n //_____________________________________________________________________________\n@@ -113,14 +113,14 @@ void PathSpring::extendFinalizeFromProperties()\n {\n     Super::extendFinalizeFromProperties();\n \n-    GeometryPath& path = upd_GeometryPath();\n+\tGeometryPath& path = upd_GeometryPath();\n     path.setName("path");\n     path.setDefaultColor(DefaultPathSpringColor);\n-    addComponent(&path);\n+\taddComponent(&path);\n \n-    // Resting length must be greater than 0.0.\n+\t// Resting length must be greater than 0.0.\n     assert(get_resting_length() > 0.0);\n-    path.setOwner(this);\n+\tpath.setOwner(this);\n }\n \n \n@@ -139,30 +139,30 @@ void PathSpring::extendFinalizeFromProperties()\n  */\n double PathSpring::getLength(const SimTK::State& s) const\n {\n-    return getGeometryPath().getLength(s);\n+\treturn getGeometryPath().getLength(s);\n }\n \n double PathSpring::getStretch(const SimTK::State& s) const\n {\n-    const double& length = getLength(s);\n-    const double& restingLength = get_resting_length();\n-    return length > restingLength ? (length-restingLength) : 0.0;\n+\tconst double& length = getLength(s);\n+\tconst double& restingLength = get_resting_length();\n+\treturn length > restingLength ? (length-restingLength) : 0.0;\n }\n \n \n double PathSpring::getLengtheningSpeed(const SimTK::State& s) const\n {\n-    return getGeometryPath().getLengtheningSpeed(s);\n+\treturn getGeometryPath().getLengtheningSpeed(s);\n }\n \n double PathSpring::getTension(const SimTK::State& s) const\n {\n-    // evaluate tension in the spring\n-    // note tension is positive and produces shortening\n-    // damping opposes lengthening, which is positive lengthening speed\n-    // there for stretch and lengthening speed increase tension\n-    return getStiffness()*getStretch(s) *                   //elastic force\n-                (1+getDissipation()*getLengtheningSpeed(s));   //dissipation \n+\t// evaluate tension in the spring\n+\t// note tension is positive and produces shortening\n+\t// damping opposes lengthening, which is positive lengthening speed\n+\t// there for stretch and lengthening speed increase tension\n+\treturn getStiffness()*getStretch(s) *\t\t\t\t\t//elastic force\n+\t\t\t\t(1+getDissipation()*getLengtheningSpeed(s));   //dissipation \n }\n \n \n@@ -179,14 +179,14 @@ double PathSpring::getTension(const SimTK::State& s) const\n  */\n void PathSpring::preScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().preScale(s, aScaleSet);\n+\tupdGeometryPath().preScale(s, aScaleSet);\n }\n \n //_____________________________________________________________________________\n \n void PathSpring::scale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    updGeometryPath().scale(s, aScaleSet);\n+\tupdGeometryPath().scale(s, aScaleSet);\n }\n \n //_____________________________________________________________________________\n@@ -199,18 +199,18 @@ void PathSpring::scale(const SimTK::State& s, const ScaleSet& aScaleSet)\n  */\n void PathSpring::postScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n {\n-    GeometryPath& path = updGeometryPath();\n-    path.postScale(s, aScaleSet);\n-\n-    if (path.getPreScaleLength(s) > 0.0)\n-    {\n-        double scaleFactor = path.getLength(s) / path.getPreScaleLength(s);\n-        // Scale resting length by the same amount as the change in\n-        // total PathSpring length (in the current body position).\n-        upd_resting_length() *= scaleFactor;\n-\n-        path.setPreScaleLength(s, 0.0);\n-    }\n+\tGeometryPath& path = updGeometryPath();\n+\tpath.postScale(s, aScaleSet);\n+\n+\tif (path.getPreScaleLength(s) > 0.0)\n+\t{\n+\t\tdouble scaleFactor = path.getLength(s) / path.getPreScaleLength(s);\n+\t\t// Scale resting length by the same amount as the change in\n+\t\t// total PathSpring length (in the current body position).\n+\t\tupd_resting_length() *= scaleFactor;\n+\n+\t\tpath.setPreScaleLength(s, 0.0);\n+\t}\n }\n \n \n@@ -222,38 +222,34 @@ void PathSpring::postScale(const SimTK::State& s, const ScaleSet& aScaleSet)\n  */\n double PathSpring::computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const\n {\n-    return getGeometryPath().computeMomentArm(s, aCoord);\n+\treturn getGeometryPath().computeMomentArm(s, aCoord);\n }\n \n \n \n void PathSpring::computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const\n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const\n {\n-    const GeometryPath& path = getGeometryPath();\n-    const double& tension = getTension(s);\n+\tconst GeometryPath& path = getGeometryPath();\n+\tconst double& tension = getTension(s);\n \n-    OpenSim::Array<PointForceDirection*> PFDs;\n-    path.getPointForceDirections(s, &PFDs);\n+\tOpenSim::Array<PointForceDirection*> PFDs;\n+\tpath.getPointForceDirections(s, &PFDs);\n \n-    for (int i=0; i < PFDs.getSize(); i++) {\n-        applyForceToPoint(s, PFDs[i]->body(), PFDs[i]->point(), \n+\tfor (int i=0; i < PFDs.getSize(); i++) {\n+\t\tapplyForceToPoint(s, PFDs[i]->body(), PFDs[i]->point(), \n                           tension*PFDs[i]->direction(), bodyForces);\n-    }\n+\t}\n \n-    for(int i=0; i < PFDs.getSize(); i++)\n-        delete PFDs[i];\n+\tfor(int i=0; i < PFDs.getSize(); i++)\n+\t\tdelete PFDs[i];\n }\n \n //_____________________________________________________________________________\n /**\n  * Get the visible object used to represent the PathSpring.\n  */\n-const VisibleObject* PathSpring::getDisplayer() const\n-{ \n-    return getGeometryPath().getDisplayer(); \n-}\n \n //_____________________________________________________________________________\n /**\n@@ -261,5 +257,5 @@ const VisibleObject* PathSpring::getDisplayer() const\n  */\n void PathSpring::updateDisplayer(const SimTK::State& s) const\n {\n-    getGeometryPath().updateDisplayer(s);\n+\tgetGeometryPath().updateDisplayer(s);\n }\ndiff --git a/OpenSim/Simulation/Model/PathSpring.h b/OpenSim/Simulation/Model/PathSpring.h\nindex 28abc1920..d2dea1586 100644\n--- a/OpenSim/Simulation/Model/PathSpring.h\n+++ b/OpenSim/Simulation/Model/PathSpring.h\n@@ -61,136 +61,135 @@ public:\n     These are the serializable properties associated with this class. **/\n     /**@{**/\n     OpenSim_DECLARE_PROPERTY(resting_length, double,\n-        "The resting length (m) of the PathSpring");\n-    OpenSim_DECLARE_PROPERTY(stiffness, double,\n-        "The linear stiffness (N/m) of the PathSpring");\n-    OpenSim_DECLARE_PROPERTY(dissipation, double,\n-        "The dissipation factor (s/m) of the PathSpring");\n-    OpenSim_DECLARE_UNNAMED_PROPERTY(GeometryPath, \n-        "The GeometryPath defines the set of points and wrapping surface" \n-        "interactions that form the path of action of the PathSpring");\n+\t\t"The resting length (m) of the PathSpring");\n+\tOpenSim_DECLARE_PROPERTY(stiffness, double,\n+\t\t"The linear stiffness (N/m) of the PathSpring");\n+\tOpenSim_DECLARE_PROPERTY(dissipation, double,\n+\t\t"The dissipation factor (s/m) of the PathSpring");\n+\tOpenSim_DECLARE_UNNAMED_PROPERTY(GeometryPath, \n+\t\t"The GeometryPath defines the set of points and wrapping surface" \n+\t\t"interactions that form the path of action of the PathSpring");\n     /**@}**/\n \n \n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    \n-    /** Default constructor */\n-    PathSpring();\n+\t\n+\t/** Default constructor */\n+\tPathSpring();\n \n-    /** Convenience constructor with PathSpring parameters\n+\t/** Convenience constructor with PathSpring parameters\n      * @param name          name of this %PathSpring Object\n-     * @param restLength    the spring\'s resting length\n-     * @param stiffness     the spring stiffness\n-     * @param dissipation   the dissipation factor */\n-    PathSpring(const std::string& name, \n-        double restLength, double stiffness, double dissipation);\n+\t * @param restLength\tthe spring\'s resting length\n+\t * @param stiffness\t\tthe spring stiffness\n+\t * @param dissipation\tthe dissipation factor */\n+\tPathSpring(const std::string& name, \n+\t\tdouble restLength, double stiffness, double dissipation);\n \n \n     // Uses default (compiler-generated) destructor, copy constructor, and copy\n     // assignment operator.\n \n-    //--------------------------------------------------------------------------\n-    //  <B> Get and set PathSpring properties </B>\n-    //--------------------------------------------------------------------------\n-    // Properties\n-    /** get/set the resting length */\n-    double getRestingLength() const \n+\t//--------------------------------------------------------------------------\n+\t//  <B> Get and set PathSpring properties </B>\n+\t//--------------------------------------------------------------------------\n+\t// Properties\n+\t/** get/set the resting length */\n+\tdouble getRestingLength() const \n     {   return get_resting_length(); }\n-    void setRestingLength(double restingLength);\n+\tvoid setRestingLength(double restingLength);\n \n-    /** get/set the stiffness */\n-    double getStiffness() const \n+\t/** get/set the stiffness */\n+\tdouble getStiffness() const \n     {   return get_stiffness(); }\n-    void setStiffness(double stiffness);\n+\tvoid setStiffness(double stiffness);\n \n-    /** get/set the dissipation factor */\n-    double getDissipation() const \n+\t/** get/set the dissipation factor */\n+\tdouble getDissipation() const \n     {   return get_dissipation(); }\n-    void setDissipation(double dissipation);\n+\tvoid setDissipation(double dissipation);\n \n-    /** Access the GeometryPath to update connection points and\n-        specify wrap objects the path can interact with. */\n-    const GeometryPath& getGeometryPath() const \n+\t/** Access the GeometryPath to update connection points and\n+\t    specify wrap objects the path can interact with. */\n+\tconst GeometryPath& getGeometryPath() const \n     {   return get_GeometryPath(); }\n-    GeometryPath& updGeometryPath() \n+\tGeometryPath& updGeometryPath() \n     {   return upd_GeometryPath(); }\n \n-    //--------------------------------------------------------------------------\n-    //  <B> State dependent values </B>\n-    //--------------------------------------------------------------------------\n-    /** get the length of the PathSpring. Accessible at Stage::Position*/\n-    double getLength(const SimTK::State& s) const;\n-    /** get the stretch in the PathSpring. The value of the stretch \n-        can only be obtained after the system as be realized to Stage::Position*/\n-    double getStretch(const SimTK::State& s) const;\n-    /** get the length of the PathSpring. Accessible at Stage::Velocity*/\n-    double getLengtheningSpeed(const SimTK::State& s) const;\n-    /** get the tension generated by the PathSpring. The value of the tension \n-        can only be obtained after the system as be realized to Stage::Dynamics */\n-    double getTension(const SimTK::State& s) const;\n-\n-    //--------------------------------------------------------------------------\n-    // COMPUTATIONS\n-    //--------------------------------------------------------------------------\n-    /** compute the moment-arm of the PathSpring about a coordinat of interest. */\n-    double computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const;\n-\n-    //--------------------------------------------------------------------------\n-    // SCALE\n-    //--------------------------------------------------------------------------\n-    /**\n-     * Scale the PathSpring.\n-     * @param s     the (SimTK::) State of system that defines the current pose\n-     * @param scaleSet XYZ scale factors for all the bodies in the model\n-     */\n-    void preScale(const SimTK::State& s, const ScaleSet& scaleSet);\n-    void scale(const SimTK::State& s, const ScaleSet& scaleSet);\n-    void postScale(const SimTK::State& s, const ScaleSet& scaleSet);\n+\t//--------------------------------------------------------------------------\n+\t//  <B> State dependent values </B>\n+\t//--------------------------------------------------------------------------\n+\t/** get the length of the PathSpring. Accessible at Stage::Position*/\n+\tdouble getLength(const SimTK::State& s) const;\n+\t/** get the stretch in the PathSpring. The value of the stretch \n+\t    can only be obtained after the system as be realized to Stage::Position*/\n+\tdouble getStretch(const SimTK::State& s) const;\n+\t/** get the length of the PathSpring. Accessible at Stage::Velocity*/\n+\tdouble getLengtheningSpeed(const SimTK::State& s) const;\n+\t/** get the tension generated by the PathSpring. The value of the tension \n+\t    can only be obtained after the system as be realized to Stage::Dynamics */\n+\tdouble getTension(const SimTK::State& s) const;\n+\n+\t//--------------------------------------------------------------------------\n+\t// COMPUTATIONS\n+\t//--------------------------------------------------------------------------\n+\t/** compute the moment-arm of the PathSpring about a coordinat of interest. */\n+\tdouble computeMomentArm(const SimTK::State& s, Coordinate& aCoord) const;\n+\n+\t//--------------------------------------------------------------------------\n+\t// SCALE\n+\t//--------------------------------------------------------------------------\n+\t/**\n+\t * Scale the PathSpring.\n+\t * @param s\t\tthe (SimTK::) State of system that defines the current pose\n+\t * @param scaleSet XYZ scale factors for all the bodies in the model\n+\t */\n+\tvoid preScale(const SimTK::State& s, const ScaleSet& scaleSet);\n+\tvoid scale(const SimTK::State& s, const ScaleSet& scaleSet);\n+\tvoid postScale(const SimTK::State& s, const ScaleSet& scaleSet);\n \n protected:\n-    /** Implementation of Force component virtual method */\n-    void computeForce(const SimTK::State& s, \n-                              SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n-                              SimTK::Vector& generalizedForces) const override; \n+\t/** Implementation of Force component virtual method */\n+\tvoid computeForce(const SimTK::State& s, \n+\t\t\t\t\t\t\t  SimTK::Vector_<SimTK::SpatialVec>& bodyForces, \n+\t\t\t\t\t\t\t  SimTK::Vector& generalizedForces) const override; \n \n     /** Implement ModelComponent interface. */\n     void extendFinalizeFromProperties() override;\n \n-    //Force reporting\n-    /** \n-     * Methods to query a Force for the value actually applied during simulation\n-     * The names of the quantities (column labels) is returned by this first function\n-     * getRecordLabels()\n-     */\n-    OpenSim::Array<std::string> getRecordLabels() const {\n-        OpenSim::Array<std::string> labels("");\n-        labels.append(getName()+"_tension");\n-        return labels;\n-    }\n-    /**\n-     * Given SimTK::State object extract all the values necessary to report forces, application location\n-     * frame, etc. used in conjunction with getRecordLabels and should return same size Array\n-     */\n-    OpenSim::Array<double> getRecordValues(const SimTK::State& state) const {\n-        OpenSim::Array<double> values(1);\n-        values.append(getTension(state));\n-        return values;\n-    }\n-\n-    //--------------------------------------------------------------------------\n-    // Display\n-    //--------------------------------------------------------------------------\n-    const VisibleObject* getDisplayer() const override;\n-    void updateDisplayer(const SimTK::State& s) const override;\n+\t//Force reporting\n+\t/** \n+\t * Methods to query a Force for the value actually applied during simulation\n+\t * The names of the quantities (column labels) is returned by this first function\n+\t * getRecordLabels()\n+\t */\n+\tOpenSim::Array<std::string> getRecordLabels() const {\n+\t\tOpenSim::Array<std::string> labels("");\n+\t\tlabels.append(getName()+"_tension");\n+\t\treturn labels;\n+\t}\n+\t/**\n+\t * Given SimTK::State object extract all the values necessary to report forces, application location\n+\t * frame, etc. used in conjunction with getRecordLabels and should return same size Array\n+\t */\n+\tOpenSim::Array<double> getRecordValues(const SimTK::State& state) const {\n+\t\tOpenSim::Array<double> values(1);\n+\t\tvalues.append(getTension(state));\n+\t\treturn values;\n+\t}\n+\n+\t//--------------------------------------------------------------------------\n+\t// Display\n+\t//--------------------------------------------------------------------------\n+\tvoid updateDisplayer(const SimTK::State& s) const override;\n \n private:\n     void constructProperties() override;\n     void constructOutputs() override;\n \n //=============================================================================\n-};  // END of class PathSpring\n+};\t// END of class PathSpring\n //=============================================================================\n //=============================================================================\n } // end of namespace OpenSim\ndiff --git a/OpenSim/Simulation/Model/PointToPointSpring.cpp b/OpenSim/Simulation/Model/PointToPointSpring.cpp\nindex 26451af6b..567f49af8 100644\n--- a/OpenSim/Simulation/Model/PointToPointSpring.cpp\n+++ b/OpenSim/Simulation/Model/PointToPointSpring.cpp\n@@ -38,7 +38,7 @@ using namespace std;\n //Default constructor.\n PointToPointSpring::PointToPointSpring()\n {\n-    setNull();\n+\tsetNull();\n     constructInfrastructure();\n }\n //_____________________________________________________________________________\n@@ -46,20 +46,20 @@ PointToPointSpring::PointToPointSpring()\n PointToPointSpring::\n     PointToPointSpring(const PhysicalFrame& body1, SimTK::Vec3 point1, \n                        const PhysicalFrame& body2, SimTK::Vec3 point2,\n-                       double stiffness, double restlength )\n+                                       double stiffness, double restlength )\n {\n-    setNull();\n+\tsetNull();\n     constructInfrastructure();\n \n     // Set properties to the passed-in values.\n     setBody1(body1);\n     setBody2(body2);\n \n-    setPoint1(point1);\n-    setPoint2(point2);\n+\tsetPoint1(point1);\n+\tsetPoint2(point2);\n \n-    setStiffness(stiffness);\n-    setRestlength(restlength);\n+\tsetStiffness(stiffness);\n+\tsetRestlength(restlength);\n }\n \n void PointToPointSpring::constructConnectors()\n@@ -77,7 +77,7 @@ void PointToPointSpring::constructConnectors()\n  */\n void PointToPointSpring::setNull()\n {\n-    setAuthors("Ajay Seth"); \n+\tsetAuthors("Ajay Seth"); \n }\n \n \n@@ -87,12 +87,12 @@ void PointToPointSpring::setNull()\n  */\n void PointToPointSpring::constructProperties()\n {\n-    const SimTK::Vec3 bodyOrigin(0.0, 0.0, 0.0);\n-    constructProperty_point1(bodyOrigin);\n-    constructProperty_point2(bodyOrigin);\n+\tconst SimTK::Vec3 bodyOrigin(0.0, 0.0, 0.0);\n+\tconstructProperty_point1(bodyOrigin);\n+\tconstructProperty_point2(bodyOrigin);\n \n-    constructProperty_stiffness(1.0);\n-    constructProperty_rest_length(0.0);\n+\tconstructProperty_stiffness(1.0);\n+\tconstructProperty_rest_length(0.0);\n }\n \n void PointToPointSpring::setBody1(const PhysicalFrame& body)\n@@ -115,42 +115,32 @@ const PhysicalFrame& PointToPointSpring::getBody2() const\n     return getConnector<PhysicalFrame>("body2").getConnectee();\n }\n \n-\n-//_____________________________________________________________________________\n-/**\n- * Get the visible object used to represent the spring.\n- */\n-VisibleObject* PointToPointSpring::getDisplayer() const\n-{ \n-    return const_cast<VisibleObject*>(&_displayer); \n-}\n-\n void PointToPointSpring::updateDisplayer(const SimTK::State& s)\n {\n-    SimTK::Vec3 globalLocation1, globalLocation2;\n+\tSimTK::Vec3 globalLocation1, globalLocation2;\n     const PhysicalFrame& body1 = getBody1();\n     const PhysicalFrame& body2 = getBody2();\n-\n+    /**\n     globalLocation1 = body1.getGroundTransform(s)*getPoint1();\n     globalLocation2 = body2.getGroundTransform(s)*getPoint2();\n \n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    ((LineGeometry *)_displayer.getGeometry(0))->\n-        setPoints(globalLocation1, globalLocation2);\n+\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t}\n+\t((LineGeometry *)_displayer.getGeometry(0))->\n+        setPoints(globalLocation1, globalLocation2);*/\n }\n \n void PointToPointSpring::updateGeometry(const SimTK::State& s)\n {\n-    if (_displayer.countGeometry()==0){\n-        Geometry *g = new LineGeometry();\n-        g->setFixed(false);\n-        _displayer.addGeometry(g);\n-    }\n-    updateDisplayer(s);\n+/*\tif (_displayer.countGeometry()==0){\n+\t\tGeometry *g = new LineGeometry();\n+\t\tg->setFixed(false);\n+\t\t_displayer.addGeometry(g);\n+\t}*/\n+\tupdateDisplayer(s);\n }\n \n //=============================================================================\n@@ -160,7 +150,7 @@ void PointToPointSpring::extendConnectToModel(Model& model)\n {\n     Super::extendConnectToModel(model); // Let base class connect first.\n \n-    if(getName() == "")\n+\tif(getName() == "")\n         setName("pointToPointSpring");\n }\n \n@@ -174,19 +164,19 @@ void PointToPointSpring::extendAddToSystem(SimTK::MultibodySystem& system) const\n     const PhysicalFrame& body1 = getBody1();\n     const PhysicalFrame& body2 = getBody2();\n \n-    // Get underlying mobilized bodies\n+\t// Get underlying mobilized bodies\n     const SimTK::MobilizedBody& b1 = body1.getMobilizedBody();\n     const SimTK::MobilizedBody& b2 = body2.getMobilizedBody();\n \n     // Now create a Simbody Force::TwoPointLinearSpring\n     SimTK::Force::TwoPointLinearSpring simtkSpring\n-        (_model->updForceSubsystem(), b1, getPoint1(), b2, getPoint2(), \n+       (_model->updForceSubsystem(), b1, getPoint1(), b2, getPoint2(), \n         getStiffness(), getRestlength());\n     \n     // Beyond the const Component get the index so we can access the \n     // SimTK::Force later.\n-    PointToPointSpring* mutableThis = const_cast<PointToPointSpring *>(this);\n-    mutableThis->_index = simtkSpring.getForceIndex();\n+\tPointToPointSpring* mutableThis = const_cast<PointToPointSpring *>(this);\n+\tmutableThis->_index = simtkSpring.getForceIndex();\n }\n \n \n@@ -201,56 +191,56 @@ OpenSim::Array<std::string> PointToPointSpring::getRecordLabels() const\n     const string& body1Name = getBody1().getName();\n     const string& body2Name = getBody2().getName();\n \n-    OpenSim::Array<std::string> labels("");\n-    labels.append(getName()+"."+body1Name+".force.X");\n-    labels.append(getName()+"."+body1Name+".force.Y");\n-    labels.append(getName()+"."+body1Name+".force.Z");\n-    labels.append(getName()+"."+body1Name+".point.X");\n-    labels.append(getName()+"."+body1Name+".point.Y");\n-    labels.append(getName()+"."+body1Name+".point.Z");\n-    labels.append(getName()+"."+body2Name+".force.X");\n-    labels.append(getName()+"."+body2Name+".force.Y");\n-    labels.append(getName()+"."+body2Name+".force.Z");\n-    labels.append(getName()+"."+body2Name+".point.X");\n-    labels.append(getName()+"."+body2Name+".point.Y");\n-    labels.append(getName()+"."+body2Name+".point.Z");\n-\n-    return labels;\n+\tOpenSim::Array<std::string> labels("");\n+\tlabels.append(getName()+"."+body1Name+".force.X");\n+\tlabels.append(getName()+"."+body1Name+".force.Y");\n+\tlabels.append(getName()+"."+body1Name+".force.Z");\n+\tlabels.append(getName()+"."+body1Name+".point.X");\n+\tlabels.append(getName()+"."+body1Name+".point.Y");\n+\tlabels.append(getName()+"."+body1Name+".point.Z");\n+\tlabels.append(getName()+"."+body2Name+".force.X");\n+\tlabels.append(getName()+"."+body2Name+".force.Y");\n+\tlabels.append(getName()+"."+body2Name+".force.Z");\n+\tlabels.append(getName()+"."+body2Name+".point.X");\n+\tlabels.append(getName()+"."+body2Name+".point.Y");\n+\tlabels.append(getName()+"."+body2Name+".point.Z");\n+\n+\treturn labels;\n }\n \n // Provide the value(s) to be reported that correspond to the labels.\n OpenSim::Array<double> PointToPointSpring::\n getRecordValues(const SimTK::State& state) const \n {\n-    OpenSim::Array<double> values(1);\n+\tOpenSim::Array<double> values(1);\n \n-    const SimTK::Force::TwoPointLinearSpring& \n+\tconst SimTK::Force::TwoPointLinearSpring& \n         simtkSpring = SimTK::Force::TwoPointLinearSpring::downcast\n                                 (_model->getForceSubsystem().getForce(_index));\n \n-    SimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n-    SimTK::Vector_<SimTK::Vec3> particleForces(0);\n-    SimTK::Vector mobilityForces(0);\n+\tSimTK::Vector_<SimTK::SpatialVec> bodyForces(0);\n+\tSimTK::Vector_<SimTK::Vec3> particleForces(0);\n+\tSimTK::Vector mobilityForces(0);\n \n     const PhysicalFrame& body1 = getBody1();\n     const PhysicalFrame& body2 = getBody2();\n \n-    //get the net force added to the system contributed by the Spring\n-    simtkSpring.calcForceContribution(state, bodyForces, particleForces, \n+\t//get the net force added to the system contributed by the Spring\n+\tsimtkSpring.calcForceContribution(state, bodyForces, particleForces, \n                                       mobilityForces);\n     SimTK::Vec3 forces = bodyForces(body1.getMobilizedBodyIndex())[1];\n-    values.append(3, &forces[0]);\n+\tvalues.append(3, &forces[0]);\n \n-    SimTK::Vec3 gpoint(0);\n-    _model->getSimbodyEngine().getPosition(state, body1, getPoint1(), gpoint);\n-    values.append(3, &gpoint[0]);\n+\tSimTK::Vec3 gpoint(0);\n+\t_model->getSimbodyEngine().getPosition(state, body1, getPoint1(), gpoint);\n+\tvalues.append(3, &gpoint[0]);\n \n     forces = bodyForces(body2.getMobilizedBodyIndex())[1];\n-    values.append(3, &forces[0]);\n+\tvalues.append(3, &forces[0]);\n \n-    _model->getSimbodyEngine().getPosition(state, body2, getPoint2(), gpoint);\n-    values.append(3, &gpoint[0]);\n+\t_model->getSimbodyEngine().getPosition(state, body2, getPoint2(), gpoint);\n+\tvalues.append(3, &gpoint[0]);\n \n-    return values;\n+\treturn values;\n }\n \ndiff --git a/OpenSim/Simulation/Model/PointToPointSpring.h b/OpenSim/Simulation/Model/PointToPointSpring.h\nindex 53d226058..e885337bf 100644\n--- a/OpenSim/Simulation/Model/PointToPointSpring.h\n+++ b/OpenSim/Simulation/Model/PointToPointSpring.h\n@@ -24,7 +24,6 @@\n  * -------------------------------------------------------------------------- */\n \n #include "Force.h"\n-#include <OpenSim/Common/VisibleObject.h>\n \n //==============================================================================\n //==============================================================================\n@@ -48,13 +47,13 @@ public:\n     /** @name Property declarations\n     These are the serializable properties associated with this class. **/\n     /**@{**/\n-    OpenSim_DECLARE_PROPERTY(point1, SimTK::Vec3,\n+\tOpenSim_DECLARE_PROPERTY(point1, SimTK::Vec3,\n         "Spring attachment point on body1.");\n-    OpenSim_DECLARE_PROPERTY(point2, SimTK::Vec3,\n+\tOpenSim_DECLARE_PROPERTY(point2, SimTK::Vec3,\n         "Spring attachment point on body2.");\n-    OpenSim_DECLARE_PROPERTY(stiffness, double,\n-        "Spring stiffness (N/m).");\n-    OpenSim_DECLARE_PROPERTY(rest_length, double,\n+\tOpenSim_DECLARE_PROPERTY(stiffness, double,\n+\t\t"Spring stiffness (N/m).");\n+\tOpenSim_DECLARE_PROPERTY(rest_length, double,\n         "Spring resting length (m).");\n     /**@}**/\n \n@@ -62,8 +61,8 @@ public:\n //==============================================================================\n // PUBLIC METHODS\n //==============================================================================\n-    /** Default constructor. **/\n-    PointToPointSpring();\n+\t/** Default constructor. **/\n+\tPointToPointSpring();\n     /** Convenience constructor for API users.\n     @param body1        the first body to which the spring is attached\n     @param point1       location where spring is attached on body1\n@@ -78,75 +77,72 @@ public:\n \n     // default destructor, copy constructor, copy assignment\n \n-    //--------------------------------------------------------------------------\n-    // Visible Object Support\n-    //--------------------------------------------------------------------------\n-    VisibleObject* getDisplayer() const;\n-    void updateDisplayer(const SimTK::State& s);\n-    void updateGeometry(const SimTK::State& s);\n-    \n-    //-----------------------------------------------------------------------------\n-    // GET and SET Spring parameters\n-    //-----------------------------------------------------------------------------\n-    /**\n-    * Spring end point bodies \n-    */\n+\t//--------------------------------------------------------------------------\n+\t// Visible Object Support\n+\t//--------------------------------------------------------------------------\n+\tvirtual void updateDisplayer(const SimTK::State& s);\n+\tvirtual void updateGeometry(const SimTK::State& s);\n+\t\n+\t//-----------------------------------------------------------------------------\n+\t// GET and SET Spring parameters\n+\t//-----------------------------------------------------------------------------\n+\t/**\n+\t* Spring end point bodies \n+\t*/\n     void setBody1(const PhysicalFrame& body);\n     void setBody2(const PhysicalFrame& body);\n     const PhysicalFrame& getBody1() const;\n     const PhysicalFrame& getBody2() const;\n \n-    /**\n-    * Spring end points \n-    */\n-    void setPoint1(SimTK::Vec3 aPosition) { set_point1(aPosition); }\n-    const SimTK::Vec3& getPoint1() const { return get_point1(); }\n-    void setPoint2(SimTK::Vec3 aPosition) { set_point2(aPosition); }\n-    const SimTK::Vec3& getPoint2() const { return get_point2(); }\n-\n-    /**\n-    * Spring stiffness\n-    * @param stiffness \n-    */\n-    void setStiffness(double stiffness) {set_stiffness(stiffness);}\n-    double getStiffness() const {return get_stiffness();}\n-    /**\n-    * Spring resting length\n-    * @param restLength \n-    */\n-    void setRestlength(double restLength) {set_rest_length(restLength);}\n-    double getRestlength() const {return get_rest_length();}\n-\n-    //-----------------------------------------------------------------------------\n-    // ModelComponent interface\n-    //-----------------------------------------------------------------------------\n+\t/**\n+\t* Spring end points \n+\t*/\n+\tvoid setPoint1(SimTK::Vec3 aPosition) { set_point1(aPosition); }\n+\tconst SimTK::Vec3& getPoint1() const { return get_point1(); }\n+\tvoid setPoint2(SimTK::Vec3 aPosition) { set_point2(aPosition); }\n+\tconst SimTK::Vec3& getPoint2() const { return get_point2(); }\n+\n+\t/**\n+\t* Spring stiffness\n+\t* @param stiffness \n+\t*/\n+\tvoid setStiffness(double stiffness) {set_stiffness(stiffness);}\n+\tdouble getStiffness() const {return get_stiffness();}\n+\t/**\n+\t* Spring resting length\n+\t* @param restLength \n+\t*/\n+\tvoid setRestlength(double restLength) {set_rest_length(restLength);}\n+\tdouble getRestlength() const {return get_rest_length();}\n+\n+\t//-----------------------------------------------------------------------------\n+\t// ModelComponent interface\n+\t//-----------------------------------------------------------------------------\n     void extendConnectToModel(Model& model) override;\n     void extendAddToSystem(SimTK::MultibodySystem& system) const override;\n \n-    //-----------------------------------------------------------------------------\n-    // Reporting\n-    //-----------------------------------------------------------------------------\n-    /** \n-     * Provide name(s) of the quantities (column labels) of the force value(s) to be reported\n-     */\n+\t//-----------------------------------------------------------------------------\n+\t// Reporting\n+\t//-----------------------------------------------------------------------------\n+\t/** \n+\t * Provide name(s) of the quantities (column labels) of the force value(s) to be reported\n+\t */\n     OpenSim::Array<std::string> getRecordLabels() const override;\n-    /**\n-    *  Provide the value(s) to be reported that correspond to the labels\n-    */\n+\t/**\n+\t*  Provide the value(s) to be reported that correspond to the labels\n+\t*/\n     OpenSim::Array<double> getRecordValues(const SimTK::State& state) const override;\n \n protected:\n-    /** how to display the Spring */\n-    VisibleObject _displayer;\n \n private:\n-    void setNull();\n+\tvoid setNull();\n     void constructProperties() override;\n     /** These will be the two bodies the PointToPointSpring connects to.*/\n     void constructConnectors() override;\n \n //==============================================================================\n-};  // END of class PointToPointSpring\n+};\t// END of class PointToPointSpring\n \n }; //namespace\n //==============================================================================\ndiff --git a/OpenSim/Simulation/SimbodyEngine/Body.cpp b/OpenSim/Simulation/SimbodyEngine/Body.cpp\nindex 9a6be3a3c..05ec2b2cf 100644\n--- a/OpenSim/Simulation/SimbodyEngine/Body.cpp\n+++ b/OpenSim/Simulation/SimbodyEngine/Body.cpp\n@@ -47,7 +47,7 @@ using SimTK::Vec3;\n Body::Body() : PhysicalFrame()\n {\n     //_body = this;\n-    constructProperties();\n+\tconstructProperties();\n }\n \n //_____________________________________________________________________________\n@@ -57,11 +57,11 @@ Body::Body() : PhysicalFrame()\n Body::Body(const std::string &aName,double aMass,const SimTK::Vec3& aMassCenter,const SimTK::Inertia& aInertia) :\n     PhysicalFrame()\n {\n-    constructProperties();\n-    setName(aName);\n-    set_mass(aMass);\n-    set_mass_center(aMassCenter);\n-    setInertia(aInertia);\n+\tconstructProperties();\n+\tsetName(aName);\n+\tset_mass(aMass);\n+\tset_mass_center(aMassCenter);\n+\tsetInertia(aInertia);\n }\n \n //_____________________________________________________________________________\n@@ -70,9 +70,9 @@ Body::Body(const std::string &aName,double aMass,const SimTK::Vec3& aMassCenter,\n  */\n void Body::constructProperties()\n {\n-    constructProperty_mass(SimTK::NaN);\n-    constructProperty_mass_center(SimTK::Vec3(0));\n-    constructProperty_inertia(SimTK::Vec6(0));\n+\tconstructProperty_mass(SimTK::NaN);\n+\tconstructProperty_mass_center(SimTK::Vec3(0));\n+\tconstructProperty_inertia(SimTK::Vec6(0));\n }\n \n \n@@ -91,29 +91,38 @@ void Body::extendFinalizeFromProperties()\n void Body::extendConnectToModel(Model& aModel)\n {\n     Super::extendConnectToModel(aModel);\n-    \n-    int nslaves = (int)_slaves.size();\n-\n-    if (nslaves){\n-        int nbods = nslaves + 1; // include the master\n-        const SimTK::MassProperties& massProps = getMassProperties();\n-        SimTK::MassProperties slaveMassProps(massProps.getMass() / nbods,\n-            massProps.getMassCenter(), massProps.getUnitInertia());\n-\n-        // update the portion taken on by the master\n-        _internalRigidBody = SimTK::Body::Rigid(slaveMassProps);\n-\n-        // and the slaves\n-        for (int i = 0; i < nslaves; ++i){\n-            _slaves[i]->_internalRigidBody = SimTK::Body::Rigid(slaveMassProps);\n-        }\n-    }\n+\t\n+\tint nslaves = (int)_slaves.size();\n+\n+\tif (nslaves){\n+\t\tint nbods = nslaves + 1; // include the master\n+\t\tconst SimTK::MassProperties& massProps = getMassProperties();\n+\t\tSimTK::MassProperties slaveMassProps(massProps.getMass() / nbods,\n+\t\t\tmassProps.getMassCenter(), massProps.getUnitInertia());\n+\n+\t\t// update the portion taken on by the master\n+\t\t_internalRigidBody = SimTK::Body::Rigid(slaveMassProps);\n+\n+\t\t// and the slaves\n+\t\tfor (int i = 0; i < nslaves; ++i){\n+\t\t\t_slaves[i]->_internalRigidBody = SimTK::Body::Rigid(slaveMassProps);\n+\t\t}\n+\t}\n }\n \n //=============================================================================\n // GET AND SET\n //=============================================================================\n //_____________________________________________________________________________\n+/**\n+ * Add display geometry to body.\n+ *\n+ * @param aGeometryFileName Geometry filename.\n+ */\n+void Body::addDisplayGeometry(const std::string &aGeometryFileName)\n+{\n+\t//updDisplayer()->setGeometryFileName(updDisplayer()->getNumGeometryFiles(), aGeometryFileName);\n+}\n \n \n \n@@ -125,42 +134,42 @@ void Body::extendConnectToModel(Model& aModel)\n  */\n const SimTK::Inertia& Body::getInertia() const\n {\n-    // Has not been set programmatically\n-    if (_inertia.isNaN()){\n-        // initialize from properties\n-        const double& m = getMass();\n-        // if mass is zero, non-zero inertia makes no sense\n+\t// Has not been set programmatically\n+\tif (_inertia.isNaN()){\n+\t\t// initialize from properties\n+\t\tconst double& m = getMass();\n+\t\t// if mass is zero, non-zero inertia makes no sense\n         if (-SimTK::SignificantReal <= m && m <= SimTK::SignificantReal){\n-            // force zero intertia\n-            cout<<"Body \'"<<getName()<<"\' is massless but nonzero inertia provided.";\n-            cout<<" Inertia reset to zero. "<<"Otherwise provide nonzero mass."<< endl;\n-            _inertia = SimTK::Inertia(0);\n-        }\n-        else{\n-            const SimTK::Vec6& Ivec = get_inertia();\n-            try {\n-                _inertia = SimTK::Inertia(Ivec.getSubVec<3>(0), Ivec.getSubVec<3>(3));\n-            } \n-            catch (const std::exception& ex){\n-                // Should throw an Exception but we have models we have released with\n-                // bad intertias. E.g. early gait23 models had an error in the inertia\n-                // of the toes Body. We cannot allow failures with our models so \n-                // raise a warning and do something sensible with the values at hand.\n-                cout << "WARNING: Body " + getName() + " has invalid inertia. " << endl;\n-                cout << ex.what() << endl;\n-\n-                // get some aggregate value for the inertia based on exsiting values\n+\t\t\t// force zero intertia\n+\t\t\tcout<<"Body \'"<<getName()<<"\' is massless but nonzero inertia provided.";\n+\t\t\tcout<<" Inertia reset to zero. "<<"Otherwise provide nonzero mass."<< endl;\n+\t\t\t_inertia = SimTK::Inertia(0);\n+\t\t}\n+\t\telse{\n+\t\t\tconst SimTK::Vec6& Ivec = get_inertia();\n+\t\t\ttry {\n+\t\t\t\t_inertia = SimTK::Inertia(Ivec.getSubVec<3>(0), Ivec.getSubVec<3>(3));\n+\t\t\t} \n+\t\t\tcatch (const std::exception& ex){\n+\t\t\t\t// Should throw an Exception but we have models we have released with\n+\t\t\t\t// bad intertias. E.g. early gait23 models had an error in the inertia\n+\t\t\t\t// of the toes Body. We cannot allow failures with our models so \n+\t\t\t\t// raise a warning and do something sensible with the values at hand.\n+\t\t\t\tcout << "WARNING: Body " + getName() + " has invalid inertia. " << endl;\n+\t\t\t\tcout << ex.what() << endl;\n+\n+\t\t\t\t// get some aggregate value for the inertia based on exsiting values\n                 double diag = Ivec.getSubVec<3>(0).norm()/sqrt(3.0);\n \n-                // and then assume a spherical shape.\n-                _inertia = SimTK::Inertia(Vec3(diag), Vec3(0));\n-                \n-                cout << getName() << " Body\'s inertia being reset to:" << endl;\n-                cout << _inertia << endl;\n-            }\n-        }\n-    }\n-    return _inertia;\n+\t\t\t\t// and then assume a spherical shape.\n+\t\t\t\t_inertia = SimTK::Inertia(Vec3(diag), Vec3(0));\n+\t\t\t\t\n+\t\t\t\tcout << getName() << " Body\'s inertia being reset to:" << endl;\n+\t\t\t\tcout << _inertia << endl;\n+\t\t\t}\n+\t\t}\n+\t}\n+\treturn _inertia;\n }\n //_____________________________________________________________________________\n /**\n@@ -170,14 +179,14 @@ const SimTK::Inertia& Body::getInertia() const\n  */\n void Body::setInertia(const SimTK::Inertia& inertia)\n {\n-    _inertia = inertia;\n-    const SimTK::SymMat33& I = _inertia.asSymMat33();\n-    upd_inertia()[0] = I[0][0];\n-    upd_inertia()[1] = I[1][1];\n-    upd_inertia()[2] = I[2][2];\n-    upd_inertia()[3] = I[0][1];\n-    upd_inertia()[4] = I[0][2];\n-    upd_inertia()[5] = I[1][2];\n+\t_inertia = inertia;\n+\tconst SimTK::SymMat33& I = _inertia.asSymMat33();\n+\tupd_inertia()[0] = I[0][0];\n+\tupd_inertia()[1] = I[1][1];\n+\tupd_inertia()[2] = I[2][2];\n+\tupd_inertia()[3] = I[0][1];\n+\tupd_inertia()[4] = I[0][2];\n+\tupd_inertia()[5] = I[1][2];\n }\n \n //=============================================================================\n@@ -193,9 +202,9 @@ void Body::setInertia(const SimTK::Inertia& inertia)\n void Body::scale(const SimTK::Vec3& aScaleFactors, bool aScaleMass)\n {\n     Super::scale(aScaleFactors);\n-    for(int i=0; i<3; i++) {\n-        upd_mass_center()[i] *= aScaleFactors[i];\n-    }\n+\tfor(int i=0; i<3; i++) {\n+\t\tupd_mass_center()[i] *= aScaleFactors[i];\n+\t}\n \n     scaleInertialProperties(aScaleFactors, aScaleMass);\n }\n@@ -209,124 +218,124 @@ void Body::scale(const SimTK::Vec3& aScaleFactors, bool aScaleMass)\n  */\n void Body::scaleInertialProperties(const SimTK::Vec3& aScaleFactors, bool aScaleMass)\n {\n-    // Save the unscaled mass for possible use later.\n-    double unscaledMass = get_mass();\n+\t// Save the unscaled mass for possible use later.\n+\tdouble unscaledMass = get_mass();\n \n-    // Calculate and store the product of the scale factors.\n+\t// Calculate and store the product of the scale factors.\n     double massScaleFactor = abs(aScaleFactors[0] * aScaleFactors[1] * aScaleFactors[2]);\n \n-    // Scale the mass.\n-    if (aScaleMass)\n-        upd_mass() *= massScaleFactor;\n-\n-    SimTK::SymMat33 inertia = _inertia.asSymMat33();\n-\n-    // If the mass is zero, then make the inertia tensor zero as well.\n-    // If the X, Y, Z scale factors are equal, then you can scale the\n-    // inertia tensor exactly by the square of the scale factor (and\n-    // possibly by massScaleFactor), since each element in the tensor\n-    // is proportional to the square of one or more dimensional\n-    // measurements. For determining if the scale factors are equal,\n-    // ignore reflections-- look only at the absolute value of the factors.\n-    if (get_mass() <= SimTK::Eps) {\n-        inertia *= 0.0;\n-    }\n-    else if (SimTK::isNumericallyEqual(aScaleFactors[0], aScaleFactors[1])\n-             && SimTK::isNumericallyEqual(aScaleFactors[1], aScaleFactors[2])) {\n-        // If the mass is also being scaled, scale the inertia terms by massScaleFactor.\n-        if (aScaleMass) {\n-            inertia *= massScaleFactor;\n-        }\n-\n-        // Now scale by the length-squared component.\n-        inertia *= (aScaleFactors[0] * aScaleFactors[0]);\n-\n-    } else {\n-        // If the scale factors are not equal, then assume that the segment\n-        // is a cylinder and the inertia is calculated about one end of it.\n-        int axis;\n-\n-        // 1. Find the smallest diagonal component. This dimension is the axis\n-        //    of the cylinder.\n-        if (inertia[0][0] <= inertia[1][1]){\n-            if (inertia[0][0] <= inertia[2][2])\n-                axis = 0;\n-            else\n-                axis = 2;\n-\n-        } else if (inertia[1][1] <= inertia[2][2]) {\n-            axis = 1;\n-\n-        } else {\n-            axis = 2;\n-        }\n-\n-        // 2. The smallest inertia component is equal to 0.5 * mass * radius * radius,\n-        //    so you can rearrange and solve for the radius.\n-        int oa;\n-        double radius, rad_sqr, length;\n-        double term = 2.0 * inertia[axis][axis] / unscaledMass;\n-        if (term < 0.0)\n-            radius = 0.0;\n-        else\n-            radius = sqrt(term);\n-\n-        // 3. Choose either of the other diagonal components and use it to solve for the\n-        //    length of the cylinder. This component is equal to:\n-        //    0.083 * mass * length * length  +  0.25 * mass * radius * radius\n-        if (axis == 0)\n-            oa = 1;\n-        else\n-            oa = 0;\n-        term = 12.0 * (inertia[oa][oa] - 0.25 * unscaledMass * radius * radius) / unscaledMass;\n-        if (term < 0.0)\n-            length = 0.0;\n-        else\n-            length = sqrt(term);\n-\n-        // 4. Scale the radius and length, and recalculate the diagonal inertia terms.\n-        length *= aScaleFactors[axis];\n-\n-        if (axis == 0) {\n-            rad_sqr = radius * (aScaleFactors[1]) * radius * (aScaleFactors[2]);\n-            inertia[0][0] = 0.5 * get_mass() * rad_sqr;\n-            inertia[1][1] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n-            inertia[2][2] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n-\n-        } else if (axis == 1) {\n-            rad_sqr = radius * (aScaleFactors[0]) * radius * (aScaleFactors[2]);\n-            inertia[0][0] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n-            inertia[1][1] = 0.5 * get_mass() * rad_sqr;\n-            inertia[2][2] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n-\n-        } else {\n-            rad_sqr = radius * (aScaleFactors[0]) * radius * (aScaleFactors[1]);\n-            inertia[0][0] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n-            inertia[1][1] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n-            inertia[2][2] = 0.5 * get_mass() * rad_sqr;\n-        }\n-\n-        // 5. Scale the inertia products, in case some are non-zero. These are scaled by\n-        //    two scale factors for the length term (which two depend on the inertia term\n-        //    being scaled), and, if the mass is also scaled, by massScaleFactor.\n-        inertia[0][1] *= ((aScaleFactors[0] * aScaleFactors[1]));\n-        inertia[0][2] *= ((aScaleFactors[0] * aScaleFactors[2]));\n-        inertia[1][0] *= ((aScaleFactors[1] * aScaleFactors[0]));\n-        inertia[1][2] *= ((aScaleFactors[1] * aScaleFactors[2]));\n-        inertia[2][0] *= ((aScaleFactors[2] * aScaleFactors[0]));\n-        inertia[2][1] *= ((aScaleFactors[2] * aScaleFactors[1]));\n-\n-        if (aScaleMass) {\n-            inertia[0][1] *= massScaleFactor;\n-            inertia[0][2] *= massScaleFactor;\n-            inertia[1][0] *= massScaleFactor;\n-            inertia[1][2] *= massScaleFactor;\n-            inertia[2][0] *= massScaleFactor;\n-            inertia[2][1] *= massScaleFactor;\n-        }\n-    }\n-\n-    setInertia(SimTK::Inertia(inertia));\n+\t// Scale the mass.\n+\tif (aScaleMass)\n+\t\tupd_mass() *= massScaleFactor;\n+\n+\tSimTK::SymMat33 inertia = _inertia.asSymMat33();\n+\n+\t// If the mass is zero, then make the inertia tensor zero as well.\n+\t// If the X, Y, Z scale factors are equal, then you can scale the\n+\t// inertia tensor exactly by the square of the scale factor (and\n+\t// possibly by massScaleFactor), since each element in the tensor\n+\t// is proportional to the square of one or more dimensional\n+\t// measurements. For determining if the scale factors are equal,\n+\t// ignore reflections-- look only at the absolute value of the factors.\n+\tif (get_mass() <= SimTK::Eps) {\n+\t\tinertia *= 0.0;\n+\t}\n+\telse if (SimTK::isNumericallyEqual(aScaleFactors[0], aScaleFactors[1])\n+\t\t\t && SimTK::isNumericallyEqual(aScaleFactors[1], aScaleFactors[2])) {\n+\t\t// If the mass is also being scaled, scale the inertia terms by massScaleFactor.\n+\t\tif (aScaleMass) {\n+\t\t\tinertia *= massScaleFactor;\n+\t\t}\n+\n+\t\t// Now scale by the length-squared component.\n+\t\tinertia *= (aScaleFactors[0] * aScaleFactors[0]);\n+\n+\t} else {\n+\t\t// If the scale factors are not equal, then assume that the segment\n+\t\t// is a cylinder and the inertia is calculated about one end of it.\n+\t\tint axis;\n+\n+\t\t// 1. Find the smallest diagonal component. This dimension is the axis\n+\t\t//    of the cylinder.\n+\t\tif (inertia[0][0] <= inertia[1][1]){\n+\t\t\tif (inertia[0][0] <= inertia[2][2])\n+\t\t\t\taxis = 0;\n+\t\t\telse\n+\t\t\t\taxis = 2;\n+\n+\t\t} else if (inertia[1][1] <= inertia[2][2]) {\n+\t\t\taxis = 1;\n+\n+\t\t} else {\n+\t\t\taxis = 2;\n+\t\t}\n+\n+\t\t// 2. The smallest inertia component is equal to 0.5 * mass * radius * radius,\n+\t\t//    so you can rearrange and solve for the radius.\n+\t\tint oa;\n+\t\tdouble radius, rad_sqr, length;\n+\t\tdouble term = 2.0 * inertia[axis][axis] / unscaledMass;\n+\t\tif (term < 0.0)\n+\t\t\tradius = 0.0;\n+\t\telse\n+\t\t\tradius = sqrt(term);\n+\n+\t\t// 3. Choose either of the other diagonal components and use it to solve for the\n+\t\t//    length of the cylinder. This component is equal to:\n+\t\t//    0.083 * mass * length * length  +  0.25 * mass * radius * radius\n+\t\tif (axis == 0)\n+\t\t\toa = 1;\n+\t\telse\n+\t\t\toa = 0;\n+\t\tterm = 12.0 * (inertia[oa][oa] - 0.25 * unscaledMass * radius * radius) / unscaledMass;\n+\t\tif (term < 0.0)\n+\t\t\tlength = 0.0;\n+\t\telse\n+\t\t\tlength = sqrt(term);\n+\n+\t\t// 4. Scale the radius and length, and recalculate the diagonal inertia terms.\n+\t\tlength *= aScaleFactors[axis];\n+\n+\t\tif (axis == 0) {\n+\t\t\trad_sqr = radius * (aScaleFactors[1]) * radius * (aScaleFactors[2]);\n+\t\t\tinertia[0][0] = 0.5 * get_mass() * rad_sqr;\n+\t\t\tinertia[1][1] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n+\t\t\tinertia[2][2] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n+\n+\t\t} else if (axis == 1) {\n+\t\t\trad_sqr = radius * (aScaleFactors[0]) * radius * (aScaleFactors[2]);\n+\t\t\tinertia[0][0] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n+\t\t\tinertia[1][1] = 0.5 * get_mass() * rad_sqr;\n+\t\t\tinertia[2][2] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n+\n+\t\t} else {\n+\t\t\trad_sqr = radius * (aScaleFactors[0]) * radius * (aScaleFactors[1]);\n+\t\t\tinertia[0][0] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n+\t\t\tinertia[1][1] = get_mass() * ((length * length / 12.0) + 0.25 * rad_sqr);\n+\t\t\tinertia[2][2] = 0.5 * get_mass() * rad_sqr;\n+\t\t}\n+\n+\t\t// 5. Scale the inertia products, in case some are non-zero. These are scaled by\n+\t\t//    two scale factors for the length term (which two depend on the inertia term\n+\t\t//    being scaled), and, if the mass is also scaled, by massScaleFactor.\n+\t\tinertia[0][1] *= ((aScaleFactors[0] * aScaleFactors[1]));\n+\t\tinertia[0][2] *= ((aScaleFactors[0] * aScaleFactors[2]));\n+\t\tinertia[1][0] *= ((aScaleFactors[1] * aScaleFactors[0]));\n+\t\tinertia[1][2] *= ((aScaleFactors[1] * aScaleFactors[2]));\n+\t\tinertia[2][0] *= ((aScaleFactors[2] * aScaleFactors[0]));\n+\t\tinertia[2][1] *= ((aScaleFactors[2] * aScaleFactors[1]));\n+\n+\t\tif (aScaleMass) {\n+\t\t\tinertia[0][1] *= massScaleFactor;\n+\t\t\tinertia[0][2] *= massScaleFactor;\n+\t\t\tinertia[1][0] *= massScaleFactor;\n+\t\t\tinertia[1][2] *= massScaleFactor;\n+\t\t\tinertia[2][0] *= massScaleFactor;\n+\t\t\tinertia[2][1] *= massScaleFactor;\n+\t\t}\n+\t}\n+\n+\tsetInertia(SimTK::Inertia(inertia));\n }\n \n //_____________________________________________________________________________\n@@ -338,9 +347,9 @@ void Body::scaleInertialProperties(const SimTK::Vec3& aScaleFactors, bool aScale\n  */\n void Body::scaleMass(double aScaleFactor)\n {\n-    upd_mass() *= aScaleFactor;\n-    _inertia *= aScaleFactor;\n-    upd_inertia() *= aScaleFactor;\n+\tupd_mass() *= aScaleFactor;\n+\t_inertia *= aScaleFactor;\n+\tupd_inertia() *= aScaleFactor;\n }\n \n //=============================================================================\n@@ -348,26 +357,26 @@ void Body::scaleMass(double aScaleFactor)\n //=============================================================================\n SimTK::MassProperties Body::getMassProperties() const\n {\n-    const double& m = get_mass();\n-    const Vec3& com = get_mass_center();\n-\n-    try{\n-        const SimTK::Inertia& Icom = getInertia();\n-\n-        SimTK::Inertia Ib = Icom;\n-        // If com and body, b, frame are coincident then don\'t bother shifting\n-        if (com.norm() > SimTK::Eps) {\n-            // shift if com has nonzero distance from b\n-            Ib = Icom.shiftFromMassCenter(com, m);\n-        }\n-    \n-        return SimTK::MassProperties(m, com, Ib);\n-    }\n-    catch (const std::exception& ex) {\n-        string msg = "Body " + getName() + " has invalid mass properties. ";\n-        msg += ex.what();\n-        throw Exception(msg, __FILE__, __LINE__);\n-    }\n+\tconst double& m = get_mass();\n+\tconst Vec3& com = get_mass_center();\n+\n+\ttry{\n+\t\tconst SimTK::Inertia& Icom = getInertia();\n+\n+\t\tSimTK::Inertia Ib = Icom;\n+\t\t// If com and body, b, frame are coincident then don\'t bother shifting\n+\t\tif (com.norm() > SimTK::Eps) {\n+\t\t\t// shift if com has nonzero distance from b\n+\t\t\tIb = Icom.shiftFromMassCenter(com, m);\n+\t\t}\n+\t\n+\t\treturn SimTK::MassProperties(m, com, Ib);\n+\t}\n+\tcatch (const std::exception& ex) {\n+\t\tstring msg = "Body " + getName() + " has invalid mass properties. ";\n+\t\tmsg += ex.what();\n+\t\tthrow Exception(msg, __FILE__, __LINE__);\n+\t}\n }\n \n //=============================================================================\n@@ -376,45 +385,45 @@ SimTK::MassProperties Body::getMassProperties() const\n \n void Body::updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber)\n {\n-    if (versionNumber < XMLDocument::getLatestVersion()){\n-        if (versionNumber < 30500) {\n-            SimTK::Vec6 newInertia(1.0, 1.0, 1.0, 0., 0., 0.);\n-            std::string inertiaComponents[] = { "inertia_xx", "inertia_yy", "inertia_zz", "inertia_xy", "inertia_xz", "inertia_yz" };\n-            for (int i = 0; i<6; ++i){\n-                SimTK::Xml::element_iterator iIter = aNode.element_begin(inertiaComponents[i]);\n-                if (iIter != aNode.element_end()){\n-                    newInertia[i] = iIter->getValueAs<double>();\n-                    aNode.removeNode(iIter);\n-                }\n-            }\n-            std::ostringstream strs;\n-            for (int i = 0; i < 6; ++i){\n-                strs << newInertia[i];\n-                if (i < 5) strs << " ";\n-            }\n-            std::string strInertia = strs.str();\n-            SimTK::Xml::Element inertiaNode("inertia", strInertia);\n-            aNode.insertNodeAfter(aNode.element_end(), inertiaNode);\n-        }\n-    }\n-    Super::updateFromXMLNode(aNode, versionNumber);\n+\tif (versionNumber < XMLDocument::getLatestVersion()){\n+\t\tif (versionNumber < 30500) {\n+\t\t\tSimTK::Vec6 newInertia(1.0, 1.0, 1.0, 0., 0., 0.);\n+\t\t\tstd::string inertiaComponents[] = { "inertia_xx", "inertia_yy", "inertia_zz", "inertia_xy", "inertia_xz", "inertia_yz" };\n+\t\t\tfor (int i = 0; i<6; ++i){\n+\t\t\t\tSimTK::Xml::element_iterator iIter = aNode.element_begin(inertiaComponents[i]);\n+\t\t\t\tif (iIter != aNode.element_end()){\n+\t\t\t\t\tnewInertia[i] = iIter->getValueAs<double>();\n+\t\t\t\t\taNode.removeNode(iIter);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tstd::ostringstream strs;\n+\t\t\tfor (int i = 0; i < 6; ++i){\n+\t\t\t\tstrs << newInertia[i];\n+\t\t\t\tif (i < 5) strs << " ";\n+\t\t\t}\n+\t\t\tstd::string strInertia = strs.str();\n+\t\t\tSimTK::Xml::Element inertiaNode("inertia", strInertia);\n+\t\t\taNode.insertNodeAfter(aNode.element_end(), inertiaNode);\n+\t\t}\n+\t}\n+\tSuper::updateFromXMLNode(aNode, versionNumber);\n }\n \n Body* Body::addSlave()\n {\n-    Body* slave = new Body();\n-    int count = (int)_slaves.size();\n+\tBody* slave = new Body();\n+\tint count = (int)_slaves.size();\n \n-    stringstream name;\n-    name << getName() << "_slave_" << count;\n-    slave->setName(name.str());\n+\tstringstream name;\n+\tname << getName() << "_slave_" << count;\n+\tslave->setName(name.str());\n \n-    //add to internal list as memory owner\n-    _slaves.push_back(slave);\n+\t//add to internal list as memory owner\n+\t_slaves.push_back(slave);\n \n-    //add to list of subcomponents to autotically add to system and initialize\n-    addComponent(slave);\n+\t//add to list of subcomponents to autotically add to system and initialize\n+\taddComponent(slave);\n \n-    return slave;\n+\treturn slave;\n }\n \ndiff --git a/OpenSim/Simulation/SimbodyEngine/Body.h b/OpenSim/Simulation/SimbodyEngine/Body.h\nindex c39643d2a..44d018e14 100644\n--- a/OpenSim/Simulation/SimbodyEngine/Body.h\n+++ b/OpenSim/Simulation/SimbodyEngine/Body.h\n@@ -49,105 +49,106 @@ public:\n     /** @name Property declarations \n     These are the serializable properties associated with a Body. **/\n     /**@{**/\n-    OpenSim_DECLARE_PROPERTY(mass, double, \n-        "The mass of the body (kg)");\n+\tOpenSim_DECLARE_PROPERTY(mass, double, \n+\t\t"The mass of the body (kg)");\n \n-    OpenSim_DECLARE_PROPERTY(mass_center, SimTK::Vec3, \n-        "The location (Vec3) of the mass center in the body frame.");\n+\tOpenSim_DECLARE_PROPERTY(mass_center, SimTK::Vec3, \n+\t\t"The location (Vec3) of the mass center in the body frame.");\n \n-    OpenSim_DECLARE_PROPERTY(inertia, SimTK::Vec6, \n+\tOpenSim_DECLARE_PROPERTY(inertia, SimTK::Vec6, \n         "The elements of the inertia tensor (Vec6) as [Ixx Iyy Izz Ixy Ixz Iyz] "\n         "measured about the mass_center and not the body origin.");\n-    /**@}**/\n+\t/**@}**/\n \n //=============================================================================\n // PUBLIC METHODS\n //=============================================================================\n \n public:\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n-    /** default contructor*/\n-    Body();\n+\t//--------------------------------------------------------------------------\n+\t// CONSTRUCTION\n+\t//--------------------------------------------------------------------------\n+\t/** default contructor*/\n+\tBody();\n \n-    /** Convenience constructor */  \n-    Body(const std::string &aName, double aMass, const SimTK::Vec3& aMassCenter,\n-        const SimTK::Inertia& aInertia);\n+\t/** Convenience constructor */\t\n+\tBody(const std::string &aName, double aMass, const SimTK::Vec3& aMassCenter,\n+\t\tconst SimTK::Inertia& aInertia);\n \n-    // use compiler generated destructor, copy constructor and assignment operator\n+\t// use compiler generated destructor, copy constructor and assignment operator\n \n-    /** Access Properties of the Body */\n-    /** The mass of the body in kg */\n-    const double& getMass() const { return get_mass(); }\n-    void setMass(const double& mass) { set_mass(mass); }\n+\t/** Access Properties of the Body */\n+\t/** The mass of the body in kg */\n+\tconst double& getMass() const { return get_mass(); }\n+\tvoid setMass(const double& mass) { set_mass(mass); }\n \n-    /** The body center of mass location (Vec3) in the Body frame. */\n-    const SimTK::Vec3& getMassCenter() const { return get_mass_center(); }\n-    void setMassCenter(const SimTK::Vec3& com) { return set_mass_center(com); }\n+\t/** The body center of mass location (Vec3) in the Body frame. */\n+\tconst SimTK::Vec3& getMassCenter() const { return get_mass_center(); }\n+\tvoid setMassCenter(const SimTK::Vec3& com) { return set_mass_center(com); }\n \n-    /** The body\'s inertia about the center of mass location. */\n-    const SimTK::Inertia& getInertia() const;\n-    void setInertia(const SimTK::Inertia& aInertia);\n+\t/** The body\'s inertia about the center of mass location. */\n+\tconst SimTK::Inertia& getInertia() const;\n+\tvoid setInertia(const SimTK::Inertia& aInertia);\n \n-    /** Assemble body interial properties: mass, center of mass location, moment \n+\t/** Assemble body interial properties: mass, center of mass location, moment \n         of inertia about the origin of the body and return as\n         SimTK::MassProperties.\n      */\n-    SimTK::MassProperties getMassProperties() const;\n+\tSimTK::MassProperties getMassProperties() const;\n \n-    void scale(const SimTK::Vec3& aScaleFactors, bool aScaleMass = false);\n-    void scaleInertialProperties(const SimTK::Vec3& aScaleFactors, bool aScaleMass = true);\n-    void scaleMass(double aScaleFactor);\n+\tvoid scale(const SimTK::Vec3& aScaleFactors, bool aScaleMass = false);\n+\tvoid scaleInertialProperties(const SimTK::Vec3& aScaleFactors, bool aScaleMass = true);\n+\tvoid scaleMass(double aScaleFactor);\n \n+\tvirtual void addDisplayGeometry(const std::string &aGeometryFileName);\n  protected:\n \n     // Model component interface.\n     void extendFinalizeFromProperties() override;\n     void extendConnectToModel(Model& model) override;\n \n-    // Underlying multibody tree building operations. Should only be called\n-    // by the connecting Joint\n-    Body* addSlave();\n+\t// Underlying multibody tree building operations. Should only be called\n+\t// by the connecting Joint\n+\tBody* addSlave();\n \n private:\n-    /** Component Interface */\n-    void constructProperties();\n+\t/** Component Interface */\n+\tvoid constructProperties();\n \n     /** Override of the default implementation to account for versioning. */\n     void updateFromXMLNode(SimTK::Xml::Element& aNode,\n         int versionNumber = -1) override;\n \n-    /** Return the equivalent (internal) SimTK::Rigid::Body for this body.\n+\t/** Return the equivalent (internal) SimTK::Rigid::Body for this body.\n     Not valid until after extendAddToSystem on Body has been called.*/\n     const SimTK::Body& extractInternalRigidBody() const override {\n-        return _internalRigidBody;\n-    }\n+\t\treturn _internalRigidBody;\n+\t}\n \n-    // mutable because fist get constructs tensor from properties\n-    mutable SimTK::Inertia _inertia;\n+\t// mutable because fist get constructs tensor from properties\n+\tmutable SimTK::Inertia _inertia;\n \n-    SimTK::Array_<Body*> _slaves;\n+\tSimTK::Array_<Body*> _slaves;\n \n-    // Internal use for a Master body. Differs from its public MassProperties\n-    // which is the "effective" mass of the Body including internal slave\n-    // Bodies. This is just the Rigid::Body of an individual master/ slave body,\n-    // which will differ ONLY if there are slaves of a composite (master) Body \n-    // used to break loops.\n-    SimTK::Body::Rigid _internalRigidBody;\n+\t// Internal use for a Master body. Differs from its public MassProperties\n+\t// which is the "effective" mass of the Body including internal slave\n+\t// Bodies. This is just the Rigid::Body of an individual master/ slave body,\n+\t// which will differ ONLY if there are slaves of a composite (master) Body \n+\t// used to break loops.\n+\tSimTK::Body::Rigid _internalRigidBody;\n \n-    // Have to be at the Model level to build the system topology. This\n-    // involves splitting bodies to satsify loop constraints. Only the Model,\n-    // therefore, can tell a Body if it must add slaves to implement a valid\n-    // Multibody tree.\n-    friend class Model;\n+\t// Have to be at the Model level to build the system topology. This\n+\t// involves splitting bodies to satsify loop constraints. Only the Model,\n+\t// therefore, can tell a Body if it must add slaves to implement a valid\n+\t// Multibody tree.\n+\tfriend class Model;\n \n     // Joint is a friend because it creates the underlying RigidBody\n     // and sets its mass properties.\n     friend class Joint;\n \n //=============================================================================\n-};  // END of class Body\n+};\t// END of class Body\n //=============================================================================\n //=============================================================================\n \ndiff --git a/OpenSim/Simulation/Test/testProbes.cpp b/OpenSim/Simulation/Test/testProbes.cpp\nindex 1f6f2fc8f..98fd681c6 100644\n--- a/OpenSim/Simulation/Test/testProbes.cpp\n+++ b/OpenSim/Simulation/Test/testProbes.cpp\n@@ -22,9 +22,9 @@\n * -------------------------------------------------------------------------- */\n \n //============================================================================\n-//  testProbes builds an OpenSim model containing a Millard2012Equilibrium\n+//\ttestProbes builds an OpenSim model containing a Millard2012Equilibrium\n //  muscle model using the OpenSim API and applies a bunch of probes to it.\n-//      \n+//\t\t\n //     Add more test cases to address specific problems with probes\n //\n //============================================================================\n@@ -49,14 +49,14 @@ using namespace OpenSim;\n using namespace std;\n \n //==============================================================================\n-static const double IntegrationAccuracy = 1e-8;\n-static const double SimulationTestTolerance = 1e-6;\n+static const double IntegrationAccuracy         = 1e-8;\n+static const double SimulationTestTolerance     = 1e-6;\n static const double InitializationTestTolerance = 1e-8;\n-static const double CorrectnessTestTolerance = 1e-8;\n+static const double CorrectnessTestTolerance    = 1e-8;\n \n-static const int SimulationTest = 0;\n-static const int InitializationTest = 1;\n-static const int CorrectnessTest = 2;\n+static const int SimulationTest         = 0;\n+static const int InitializationTest     = 1;\n+static const int CorrectnessTest        = 2;\n \n // MUSCLE CONSTANTS\n static const double MaxIsometricForce0 = 100.0,\n@@ -94,10 +94,10 @@ void simulateMuscle(const Muscle &aMuscle,\n     double act0,\n     const Function *motion,\n     const Function *control,\n-    double integrationAccuracy,\n-    int testType,\n-    double testTolerance,\n-    bool printResults);\n+                    double integrationAccuracy,\n+                    int testType,\n+                    double testTolerance,\n+                    bool printResults);\n \n \n int main()\n@@ -105,31 +105,31 @@ int main()\n     SimTK::Array_<std::string> failures;\n \n     try {\n-        Millard2012EquilibriumMuscle muscle("muscle",\n-            MaxIsometricForce0,\n-            OptimalFiberLength0,\n-            TendonSlackLength0,\n-            PennationAngle0);\n+    Millard2012EquilibriumMuscle muscle("muscle",\n+                    MaxIsometricForce0,\n+                    OptimalFiberLength0,\n+                    TendonSlackLength0,\n+                    PennationAngle0);\n \n-        muscle.setActivationTimeConstant(Activation0);\n-        muscle.setDeactivationTimeConstant(Deactivation0);\n+    muscle.setActivationTimeConstant(Activation0);\n+    muscle.setDeactivationTimeConstant(Deactivation0);\n \n-        double x0 = 0;\n-        double act0 = 0.2;\n+    double x0 = 0;\n+    double act0 = 0.2;\n \n-        Constant control(0.5);\n+    Constant control(0.5);\n \n-        Sine motion(0.1, SimTK::Pi, 0);\n+    Sine motion(0.1, SimTK::Pi, 0);\n \n         simulateMuscle(muscle,\n             x0,\n             act0,\n             &motion,\n             &control,\n-            IntegrationAccuracy,\n-            CorrectnessTest,\n-            CorrectnessTestTolerance,\n-            true);\n+        IntegrationAccuracy,\n+        CorrectnessTest,\n+        CorrectnessTestTolerance,\n+        true);\n \n \n         cout << "Probes test passed" << endl;\n@@ -168,18 +168,18 @@ void simulateMuscle(\n     const Muscle &aMuscModel,\n     double startX,\n     double act0,\n-    const Function *motion,  // prescribe motion of free end of muscle\n-    const Function *control, // prescribed excitation signal to the muscle\n-    double integrationAccuracy,\n-    int testType,\n-    double testTolerance,\n-    bool printResults)\n+        const Function *motion,  // prescribe motion of free end of muscle\n+        const Function *control, // prescribed excitation signal to the muscle\n+        double integrationAccuracy,\n+        int testType,\n+        double testTolerance,\n+        bool printResults)\n {\n     string prescribed = (motion == NULL) ? "." : " with Prescribed Motion.";\n \n     cout << "\\n******************************************************" << endl;\n     cout << "Test " << aMuscModel.getConcreteClassName()\n-        << " Model" << prescribed << endl;\n+         << " Model" << prescribed << endl;\n     cout << "******************************************************" << endl;\n     using SimTK::Vec3;\n \n@@ -200,8 +200,8 @@ void simulateMuscle(\n     Model model;\n \n     double optimalFiberLength = aMuscModel.getOptimalFiberLength();\n-    double pennationAngle = aMuscModel.getPennationAngleAtOptimalFiberLength();\n-    double tendonSlackLength = aMuscModel.getTendonSlackLength();\n+    double pennationAngle     = aMuscModel.getPennationAngleAtOptimalFiberLength();\n+    double tendonSlackLength  = aMuscModel.getTendonSlackLength();\n \n     // Use a copy of the muscle model passed in to add path points later\n     PathActuator *aMuscle = aMuscModel.clone();\n@@ -209,16 +209,13 @@ void simulateMuscle(\n     // Get a reference to the model\'s ground body\n     Ground& ground = model.updGround();\n     ground.addDisplayGeometry("box.vtp");\n-    ground.updDisplayer()\n-        ->setScaleFactors(Vec3(anchorWidth, anchorWidth, 2 * anchorWidth));\n \n     OpenSim::Body * ball = new OpenSim::Body("ball",\n         ballMass,\n         Vec3(0),\n-        ballMass*SimTK::Inertia::sphere(ballRadius));\n+                        ballMass*SimTK::Inertia::sphere(ballRadius));\n \n     ball->addDisplayGeometry("sphere.vtp");\n-    ball->updDisplayer()->setScaleFactors(Vec3(2 * ballRadius));\n     // ball connected  to ground via a slider along X\n     double xSinG = optimalFiberLength*cos(pennationAngle) + tendonSlackLength;\n \n@@ -228,13 +225,13 @@ void simulateMuscle(\n         Vec3(0),\n         *ball,\n         Vec3(0),\n-        Vec3(0));\n+                        Vec3(0));\n \n     CoordinateSet& jointCoordinateSet = slider->upd_CoordinateSet();\n-    jointCoordinateSet[0].setName("tx");\n-    jointCoordinateSet[0].setDefaultValue(1.0);\n+        jointCoordinateSet[0].setName("tx");\n+        jointCoordinateSet[0].setDefaultValue(1.0);\n     jointCoordinateSet[0].setRangeMin(0);\n-    jointCoordinateSet[0].setRangeMax(1.0);\n+        jointCoordinateSet[0].setRangeMax(1.0);\n \n     if (motion != NULL){\n         jointCoordinateSet[0].setPrescribedFunction(*motion);\n@@ -242,7 +239,7 @@ void simulateMuscle(\n     }\n     // add ball to model\n     model.addBody(ball);\n-    model.addJoint(slider);\n+\tmodel.addJoint(slider);\n \n \n     //==========================================================================\n@@ -313,39 +310,39 @@ void simulateMuscle(\n     ic1 = 9.0;      // some arbitary initial condition.\n     muscWorkProbe->setInitialConditions(ic1);\n     model.addProbe(muscWorkProbe);\n-    model.setup();\n+\tmodel.setup();\n     cout << probeCounter++ << ") Added ActuatorPowerProbe to measure work done by the muscle" << endl;\n \n     // Add ActuatorPowerProbe to measure power generated by the muscle \n-    ActuatorPowerProbe* muscPowerProbe = new ActuatorPowerProbe(*muscWorkProbe);    // use copy constructor\n+    ActuatorPowerProbe* muscPowerProbe = new ActuatorPowerProbe(*muscWorkProbe);\t// use copy constructor\n     muscPowerProbe->setName("ActuatorPower");\n     muscPowerProbe->setOperation("value");\n     model.addProbe(muscPowerProbe);\n     cout << probeCounter++ << ") Added ActuatorPowerProbe to measure power generated by the muscle" << endl;\n \n     // Add ActuatorPowerProbe to report the muscle power MINIMUM\n-    ActuatorPowerProbe* powerProbeMinimum = new ActuatorPowerProbe(*muscPowerProbe);            // use copy constructor\n+    ActuatorPowerProbe* powerProbeMinimum = new ActuatorPowerProbe(*muscPowerProbe);\t\t\t// use copy constructor\n     powerProbeMinimum->setName("ActuatorPowerMinimum");\n     powerProbeMinimum->setOperation("minimum");\n     model.addProbe(powerProbeMinimum);\n     cout << probeCounter++ << ") Added ActuatorPowerProbe to report the muscle power MINIMUM" << endl;\n \n     // Add ActuatorPowerProbe to report the muscle power ABSOLUTE MINIMUM\n-    ActuatorPowerProbe* powerProbeMinAbs = new ActuatorPowerProbe(*muscPowerProbe);         // use copy constructor\n+    ActuatorPowerProbe* powerProbeMinAbs = new ActuatorPowerProbe(*muscPowerProbe);\t\t\t// use copy constructor\n     powerProbeMinAbs->setName("ActuatorPowerMinAbs");\n     powerProbeMinAbs->setOperation("minabs");\n     model.addProbe(powerProbeMinAbs);\n     cout << probeCounter++ << ") Added ActuatorPowerProbe to report the muscle power MINABS" << endl;\n \n     // Add ActuatorPowerProbe to report the muscle power MAXIMUM\n-    ActuatorPowerProbe* powerProbeMaximum = new ActuatorPowerProbe(*muscPowerProbe);            // use copy constructor\n+    ActuatorPowerProbe* powerProbeMaximum = new ActuatorPowerProbe(*muscPowerProbe);\t\t\t// use copy constructor\n     powerProbeMaximum->setName("ActuatorPowerMaximum");\n     powerProbeMaximum->setOperation("maximum");\n     model.addProbe(powerProbeMaximum);\n     cout << probeCounter++ << ") Added ActuatorPowerProbe to report the muscle power MAXIMUM" << endl;\n \n     // Add ActuatorPowerProbe to report the muscle power MAXABS\n-    ActuatorPowerProbe* powerProbeMaxAbs = new ActuatorPowerProbe(*muscPowerProbe);         // use copy constructor\n+    ActuatorPowerProbe* powerProbeMaxAbs = new ActuatorPowerProbe(*muscPowerProbe);\t\t\t// use copy constructor\n     powerProbeMaxAbs->setName("ActuatorPowerMaxAbs");\n     powerProbeMaxAbs->setOperation("maxabs");\n     model.addProbe(powerProbeMaxAbs);\n@@ -353,7 +350,7 @@ void simulateMuscle(\n \n \n     // Add ActuatorPowerProbe to measure the square of the power generated by the muscle \n-    ActuatorPowerProbe* muscPowerSquaredProbe = new ActuatorPowerProbe(*muscPowerProbe);    // use copy constructor\n+    ActuatorPowerProbe* muscPowerSquaredProbe = new ActuatorPowerProbe(*muscPowerProbe);\t// use copy constructor\n     muscPowerSquaredProbe->setName("ActuatorPowerSquared");\n     muscPowerSquaredProbe->setExponent(2.0);\n     model.addProbe(muscPowerSquaredProbe);\n@@ -368,7 +365,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added JointPowerProbe to measure work done by the joint" << endl;\n \n     // Add JointPowerProbe to measure power generated by the joint \n-    JointInternalPowerProbe* jointPowerProbe = new JointInternalPowerProbe(*jointWorkProbe);    // use copy constructor\n+    JointInternalPowerProbe* jointPowerProbe = new JointInternalPowerProbe(*jointWorkProbe);\t// use copy constructor\n     jointPowerProbe->setName("JointPower");\n     jointPowerProbe->setOperation("value");\n     model.addProbe(jointPowerProbe);\n@@ -383,21 +380,21 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added ActuatorForceProbe to measure the impulse of the muscle force" << endl;\n \n     // Add ActuatorForceProbe to report the muscle force \n-    ActuatorForceProbe* forceProbe = new ActuatorForceProbe(*impulseProbe);         // use copy constructor\n+    ActuatorForceProbe* forceProbe = new ActuatorForceProbe(*impulseProbe);\t\t\t// use copy constructor\n     forceProbe->setName("ActuatorForce");\n     forceProbe->setOperation("value");\n     model.addProbe(forceProbe);\n     cout << probeCounter++ << ") Added ActuatorForceProbe to report the muscle force" << endl;\n \n     // Add ActuatorForceProbe to report the square of the muscle force \n-    ActuatorForceProbe* forceSquaredProbe = new ActuatorForceProbe(*forceProbe);            // use copy constructor\n+    ActuatorForceProbe* forceSquaredProbe = new ActuatorForceProbe(*forceProbe);\t\t\t// use copy constructor\n     forceSquaredProbe->setName("ActuatorForceSquared");\n     forceSquaredProbe->setExponent(2.0);\n     model.addProbe(forceSquaredProbe);\n     cout << probeCounter++ << ") Added ActuatorForceProbe to report the square of the muscle force " << endl;\n \n     // Add ActuatorForceProbe to report the square of the muscle force for the same muscle repeated twice\n-    ActuatorForceProbe* forceSquaredProbeTwice = new ActuatorForceProbe(*forceSquaredProbe);            // use copy constructor\n+    ActuatorForceProbe* forceSquaredProbeTwice = new ActuatorForceProbe(*forceSquaredProbe);\t\t\t// use copy constructor\n     forceSquaredProbeTwice->setName("ActuatorForceSquared_RepeatedTwice");\n     forceSquaredProbeTwice->setSumForcesTogether(true);\n     forceSquaredProbeTwice->setActuatorNames(muscNamesTwice);\n@@ -405,7 +402,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added ActuatorForceProbe to report the square of the muscle force for the same muscle repeated twice" << endl;\n \n     // Add ActuatorForceProbe to report the square of the muscle force for the same muscle repeated twice, SCALED BY 0.5\n-    ActuatorForceProbe* forceSquaredProbeTwiceScaled = new ActuatorForceProbe(*forceSquaredProbeTwice);         // use copy constructor\n+    ActuatorForceProbe* forceSquaredProbeTwiceScaled = new ActuatorForceProbe(*forceSquaredProbeTwice);\t\t\t// use copy constructor\n     forceSquaredProbeTwice->setName("ActuatorForceSquared_RepeatedTwiceThenHalved");\n     double gain1 = 0.5;\n     forceSquaredProbeTwiceScaled->setGain(gain1);\n@@ -414,7 +411,7 @@ void simulateMuscle(\n \n     // Add ActuatorForceProbe to report -3.5X the muscle force \n     double gain2 = -3.50;\n-    ActuatorForceProbe* forceProbeScale = new ActuatorForceProbe(*impulseProbe);        // use copy constructor\n+    ActuatorForceProbe* forceProbeScale = new ActuatorForceProbe(*impulseProbe);\t\t// use copy constructor\n     forceProbeScale->setName("ScaleActuatorForce");\n     forceProbeScale->setOperation("value");\n     forceProbeScale->setGain(gain2);\n@@ -422,7 +419,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added ActuatorForceProbe to report -3.5X the muscle force" << endl;\n \n     // Add ActuatorForceProbe to report the differentiated muscle force \n-    ActuatorForceProbe* forceProbeDiff = new ActuatorForceProbe(*impulseProbe);     // use copy constructor\n+    ActuatorForceProbe* forceProbeDiff = new ActuatorForceProbe(*impulseProbe);\t\t// use copy constructor\n     forceProbeDiff->setName("DifferentiateActuatorForce");\n     forceProbeDiff->setOperation("differentiate");\n     model.addProbe(forceProbeDiff);\n@@ -438,7 +435,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added SystemEnergyProbe to measure the system KE+PE" << endl;\n \n     // Add SystemEnergyProbe to measure system power (d/dt system KE+PE)\n-    SystemEnergyProbe* sysPowerProbe = new SystemEnergyProbe(*sysEnergyProbe);  // use copy constructor\n+    SystemEnergyProbe* sysPowerProbe = new SystemEnergyProbe(*sysEnergyProbe);\t// use copy constructor\n     sysPowerProbe->setName("SystemPower");\n     sysPowerProbe->setDisabled(false);\n     sysPowerProbe->setOperation("differentiate");\n@@ -446,7 +443,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added SystemEnergyProbe to measure system power (d/dt system KE+PE)" << endl;\n \n     // Add ActuatorForceProbe to report the muscle force value, twice -- REPORTED INDIVIDUALLY AS VECTORS\n-    ActuatorForceProbe* forceSquaredProbeTwiceReportedIndividually1 = new ActuatorForceProbe(*forceProbe);          // use copy constructor\n+    ActuatorForceProbe* forceSquaredProbeTwiceReportedIndividually1 = new ActuatorForceProbe(*forceProbe);\t\t\t// use copy constructor\n     forceSquaredProbeTwiceReportedIndividually1->setName("MuscleForce_VALUE_VECTOR");\n     forceSquaredProbeTwiceReportedIndividually1->setSumForcesTogether(false);    // report individually\n     forceSquaredProbeTwiceReportedIndividually1->setActuatorNames(muscNamesTwice);\n@@ -456,7 +453,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added ActuatorForceProbe to report the muscle force value, twice - REPORTED INDIVIDUALLY" << endl;\n \n     // Add ActuatorForceProbe to report the differentiated muscle force value, twice -- REPORTED INDIVIDUALLY AS VECTORS\n-    ActuatorForceProbe* forceSquaredProbeTwiceReportedIndividually2 = new ActuatorForceProbe(*forceSquaredProbeTwiceReportedIndividually1);         // use copy constructor\n+    ActuatorForceProbe* forceSquaredProbeTwiceReportedIndividually2 = new ActuatorForceProbe(*forceSquaredProbeTwiceReportedIndividually1);\t\t\t// use copy constructor\n     forceSquaredProbeTwiceReportedIndividually2->setName("MuscleForce_DIFFERENTIATE_VECTOR");\n     forceSquaredProbeTwiceReportedIndividually2->setSumForcesTogether(false);    // report individually\n     forceSquaredProbeTwiceReportedIndividually2->setOperation("differentiate");\n@@ -464,7 +461,7 @@ void simulateMuscle(\n     cout << probeCounter++ << ") Added ActuatorForceProbe to report the differentiated muscle force value, twice - REPORTED INDIVIDUALLY" << endl;\n \n     // Add ActuatorForceProbe to report the integrated muscle force value, twice -- REPORTED INDIVIDUALLY AS VECTORS\n-    ActuatorForceProbe* forceSquaredProbeTwiceReportedIndividually3 = new ActuatorForceProbe(*forceSquaredProbeTwiceReportedIndividually1);         // use copy constructor\n+    ActuatorForceProbe* forceSquaredProbeTwiceReportedIndividually3 = new ActuatorForceProbe(*forceSquaredProbeTwiceReportedIndividually1);\t\t\t// use copy constructor\n     forceSquaredProbeTwiceReportedIndividually3->setName("MuscleForce_INTEGRATE_VECTOR");\n     forceSquaredProbeTwiceReportedIndividually3->setSumForcesTogether(false);    // report individually\n     forceSquaredProbeTwiceReportedIndividually3->setOperation("integrate");\n@@ -477,7 +474,7 @@ void simulateMuscle(\n     cout << "initCondVec = " << initCondVec << endl;\n \n     /* Since all components are allocated on the stack don\'t have model\n-    own them (and try to free)*/\n+       own them (and try to free)*/\n     //  model.disownAllComponents();\n     model.setName("testProbesModel");\n     cout << "Saving model... " << endl;\n@@ -567,17 +564,17 @@ void simulateMuscle(\n \n     double realTimeMultiplier = ((finalTime - initialTime) / comp_time);\n     printf("testMuscles: Realtime Multiplier: %f\\n"\n-        "           :  simulation duration / clock duration\\n"\n-        "              > 1 : faster than real time\\n"\n-        "              = 1 : real time\\n"\n-        "              < 1 : slower than real time\\n",\n+           "           :  simulation duration / clock duration\\n"\n+           "              > 1 : faster than real time\\n"\n+           "              = 1 : real time\\n"\n+           "              < 1 : slower than real time\\n",\n         realTimeMultiplier);\n \n     /*\n     ASSERT(comp_time <= (finalTime-initialTime));\n     printf("testMuscles: PASSED Realtime test\\n"\n-    "             %s simulation time: %f with accuracy %f\\n\\n",\n-    actuatorType.c_str(), comp_time , accuracy);\n+           "             %s simulation time: %f with accuracy %f\\n\\n",\n+                         actuatorType.c_str(), comp_time , accuracy);\n     */\n \n     //An analysis only writes to a dir that exists, so create here.\ndiff --git a/OpenSim/Simulation/Wrap/WrapCylinder.cpp b/OpenSim/Simulation/Wrap/WrapCylinder.cpp\nindex e6621b24e..b2881996e 100644\n--- a/OpenSim/Simulation/Wrap/WrapCylinder.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapCylinder.cpp\n@@ -31,6 +31,7 @@\n #include "WrapMath.h"\n #include <OpenSim/Common/SimmMacros.h>\n #include <OpenSim/Common/Mtx.h>\n+#include <OpenSim/Common/Geometry.h>\n #include <sstream>\n \n //=============================================================================\n@@ -58,8 +59,8 @@ WrapObject(),\n _radius(_radiusProp.getValueDbl()),\n _length(_lengthProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -81,9 +82,9 @@ WrapObject(aWrapCylinder),\n _radius(_radiusProp.getValueDbl()),\n _length(_lengthProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapCylinder);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapCylinder);\n }\n \n //=============================================================================\n@@ -103,16 +104,16 @@ void WrapCylinder::setNull()\n */\n void WrapCylinder::setupProperties()\n {\n-    // BASE CLASS\n-    //WrapObject::setupProperties();\n+\t// BASE CLASS\n+\t//WrapObject::setupProperties();\n \n-    _radiusProp.setName("radius");\n-    _radiusProp.setValue(-1.0);\n-    _propertySet.append(&_radiusProp);\n+\t_radiusProp.setName("radius");\n+\t_radiusProp.setValue(-1.0);\n+\t_propertySet.append(&_radiusProp);\n \n-    _lengthProp.setName("length");\n-    _lengthProp.setValue(1.0);\n-    _propertySet.append(&_lengthProp);\n+\t_lengthProp.setName("length");\n+\t_lengthProp.setValue(1.0);\n+\t_propertySet.append(&_lengthProp);\n }\n \n //_____________________________________________________________________________\n@@ -127,7 +128,7 @@ void WrapCylinder::scale(const SimTK::Vec3& aScaleFactors)\n    // Base class, to scale origin in body frame\n    WrapObject::scale(aScaleFactors);\n \n-    SimTK::Vec3 localScaleVector[3];\n+\tSimTK::Vec3 localScaleVector[3];\n \n    // _pose.x() holds the ellipsoid\'s X axis expressed in the\n    // body\'s reference frame, _pose.y() holds the Y, and\n@@ -137,11 +138,11 @@ void WrapCylinder::scale(const SimTK::Vec3& aScaleFactors)\n    // in the XYZ dimensions. The wrap cylinder is oriented along\n    // the Z axis, so the length is scaled by the Z scale factor,\n    // and the radius is scaled by the average of the X and Y scale factors.\n-    for (int i=0; i<3; i++) {\n-        localScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i];\n-        localScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i];\n-        localScaleVector[2][i] = _pose.z()[i] * aScaleFactors[i];\n-    }\n+\tfor (int i=0; i<3; i++) {\n+\t\tlocalScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i];\n+\t\tlocalScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i];\n+\t\tlocalScaleVector[2][i] = _pose.z()[i] * aScaleFactors[i];\n+\t}\n    _radius *= ((localScaleVector[0].norm() + localScaleVector[1].norm()) * 0.5);\n    _length *= localScaleVector[2].norm();\n }\n@@ -155,19 +156,17 @@ void WrapCylinder::scale(const SimTK::Vec3& aScaleFactors)\n */\n void WrapCylinder::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n {\n-    // Base class\n-    Super::connectToModelAndBody(aModel, aBody);\n-\n-    // maybe set a parent pointer, _body = aBody;\n-    if (_radius < 0.0)\n-    {\n-        string errorMessage = "Error: radius for WrapCylinder " + getName() + " was either not specified, or is negative.";\n-        throw Exception(errorMessage);\n-    }\n-    _displayer.freeGeometry();\n-    AnalyticCylinder* cyl = new AnalyticCylinder(_radius, _length);\n-    setGeometryQuadrants(cyl);\n-    _displayer.addGeometry(cyl);\n+\t// Base class\n+\tSuper::connectToModelAndBody(aModel, aBody);\n+\n+\t// maybe set a parent pointer, _body = aBody;\n+\tif (_radius < 0.0)\n+\t{\n+\t\tstring errorMessage = "Error: radius for WrapCylinder " + getName() + " was either not specified, or is negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\tAnalyticCylinder* cyl = new AnalyticCylinder(_radius, _length);\n+\tsetGeometryQuadrants(cyl);\n \n }\n \n@@ -179,11 +178,11 @@ void WrapCylinder::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n */\n void WrapCylinder::copyData(const WrapCylinder& aWrapCylinder)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapCylinder);\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapCylinder);\n \n-    _radius = aWrapCylinder._radius;\n-    _length = aWrapCylinder._length;\n+\t_radius = aWrapCylinder._radius;\n+\t_length = aWrapCylinder._length;\n }\n \n //_____________________________________________________________________________\n@@ -194,7 +193,7 @@ void WrapCylinder::copyData(const WrapCylinder& aWrapCylinder)\n  */\n const char* WrapCylinder::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -207,10 +206,10 @@ const char* WrapCylinder::getWrapTypeName() const\n  */\n string WrapCylinder::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _radius << "\\nheight " << _length;\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _radius << "\\nheight " << _length;\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n \n //=============================================================================\n@@ -224,10 +223,10 @@ string WrapCylinder::getDimensionsString() const\n */\n WrapCylinder& WrapCylinder::operator=(const WrapCylinder& aWrapCylinder)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapCylinder);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapCylinder);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //=============================================================================\n@@ -245,431 +244,431 @@ WrapCylinder& WrapCylinder::operator=(const WrapCylinder& aWrapCylinder)\n  * @return The status, as a WrapAction enum\n  */\n int WrapCylinder::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                                    const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\t\t\t\tconst PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n-    double dist, p11_dist, p22_dist, t, dot1, dot2, dot3, dot4, d, sin_theta,\n-        *r11, *r22, alpha, beta, r_squared = _radius * _radius;\n-    double dist1, dist2;\n-    double t12, t00;\n-\n-    Vec3 pp, vv, uu, r1a, r1b, r2a, r2b, apex, plane_normal, sum_musc, \n-        r1am, r1bm, r2am, r2bm, p11, p22, r1p, r2p, axispt, near12, \n-        vert1, vert2, mpt, apex1, apex2, l1, l2, near00;\n-\n-    int i, return_code = wrapped;\n-    bool r1_inter, r2_inter;\n-    bool constrained   = (bool) (_wrapSign != 0);\n-    bool far_side_wrap = false, long_wrap = false;\n-\n-    // In case you need any variables from the previous wrap, copy them from\n-    // the PathWrap into the WrapResult, re-normalizing the ones that were\n-    // un-normalized at the end of the previous wrap calculation.\n-    const WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n-    aWrapResult.factor = previousWrap.factor;\n-    for (i = 0; i < 3; i++)\n-    {\n-        aWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor;\n-        aWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor;\n-        aWrapResult.c1[i] = previousWrap.c1[i];\n-        aWrapResult.sv[i] = previousWrap.sv[i];\n-    }\n-\n-    aFlag = false;\n-    aWrapResult.wrap_path_length = 0.0;\n-    aWrapResult.wrap_pts.setSize(0);\n-\n-    // abort if aPoint1 or aPoint2 is inside the cylinder.\n-    if (WrapMath::CalcDistanceSquaredPointToLine(aPoint1, p0, dn) < r_squared ||\n-        WrapMath::CalcDistanceSquaredPointToLine(aPoint2, p0, dn) < r_squared)\n-    {\n-        return insideRadius;\n-    }\n-\n-    // Find the closest intersection between the muscle line segment and the line\n-    // segment from one end of the cylinder to the other. This intersection is\n-    // used in several places further down in the code to check for various\n-    // wrapping conditions.\n-    SimTK::Vec3 cylStart, cylEnd;\n-    cylStart[0] = cylEnd[0] = 0.0;\n-    cylStart[1] = cylEnd[1] = 0.0;\n-    cylStart[2] = -0.5 * _length;\n-    cylEnd[2] = 0.5 * _length;\n-\n-    WrapMath::IntersectLines(aPoint1, aPoint2, cylStart, cylEnd, near12, t12, near00, t00);\n-\n-    // abort if the cylinder is unconstrained and p1p2 misses the cylinder.\n-    // Use the return values from the above call to IntersectLines()\n-    // to perform the check.\n-    if ( ! constrained)\n-    {\n-        if (WrapMath::CalcDistanceSquaredBetweenPoints(near12, near00) < r_squared && t12 > 0.0 && t12 < 1.0)\n-        {\n-            return_code = mandatoryWrap;\n-        }\n-        else\n-        {\n-            return noWrap;\n-        }\n-    }\n-\n-    // find points p11 & p22 on the cylinder axis closest aPoint1 & aPoint2\n-    WrapMath::GetClosestPointOnLineToPoint(aPoint1, p0, dn, p11, t);\n-    WrapMath::GetClosestPointOnLineToPoint(aPoint2, p0, dn, p22, t);\n-\n-    // find preliminary tangent point candidates r1a & r1b\n-    MAKE_3DVECTOR(p11, aPoint1, vv);\n-\n-    p11_dist = Mtx::Normalize(3, vv, vv);\n-\n-    sin_theta = _radius / p11_dist;\n-\n-    dist = _radius * sin_theta;\n-\n-    for (i = 0; i < 3; i++)\n-        pp[i] = p11[i] + dist * vv[i];\n-\n-    dist = sqrt(r_squared - dist * dist);\n-\n-    Mtx::CrossProduct(dn, vv, uu);\n-\n-    for (i = 0; i < 3; i++)\n-    {\n-        r1a[i] = pp[i] + dist * uu[i];\n-        r1b[i] = pp[i] - dist * uu[i];\n-    }\n-\n-    // find preliminary tangent point candidates r2a & r2b\n-    MAKE_3DVECTOR(p22, aPoint2, vv);\n-\n-    p22_dist = Mtx::Normalize(3, vv, vv);\n-\n-    sin_theta = _radius / p22_dist;\n-\n-    dist = _radius * sin_theta;\n-\n-    for (i = 0; i < 3; i++)\n-        pp[i] = p22[i] + dist * vv[i];\n-\n-    dist = sqrt(r_squared - dist * dist);\n-\n-    Mtx::CrossProduct(dn, vv, uu);\n-\n-    for (i = 0; i < 3; i++)\n-    {\n-        r2a[i] = pp[i] + dist * uu[i];\n-        r2b[i] = pp[i] - dist * uu[i];\n-    }\n-\n-    // choose the best preliminary tangent points r1 & r2 from the 4 candidates.\n-    if (constrained)\n-    {\n-        SimTK::Vec3 sum_r;\n-\n-        if (DSIGN(aPoint1[_wrapAxis]) == _wrapSign || DSIGN(aPoint2[_wrapAxis]) == _wrapSign)\n-        {\n-            // If either muscle point is on the constrained side, then check for intersection\n-            // of the muscle line and the cylinder. If there is an intersection, then\n-            // you\'ve found a mandatory wrap. If not, then if one point is not on the constrained\n-            // side and the closest point on the line is not on the constrained side, you\'ve\n-            // found a potential wrap. Otherwise, there is no wrap.\n-            // Use the return values from the previous call to IntersectLines()\n-            // to perform these checks.\n-            if (WrapMath::CalcDistanceSquaredBetweenPoints(near12, near00) < r_squared && t12 > 0.0 && t12 < 1.0)\n-            {\n-                return_code = mandatoryWrap;\n-            }\n-            else\n-            {\n-                if (DSIGN(aPoint1[_wrapAxis]) != DSIGN(aPoint2[_wrapAxis]) && DSIGN(near12[_wrapAxis]) != _wrapSign)\n-                {\n-                    return_code = wrapped;\n-                }\n-                else\n-                {\n-                    return noWrap;\n-                }\n-            }\n-        }\n-\n-        MAKE_3DVECTOR(p11, r1a, r1am);\n-        MAKE_3DVECTOR(p11, r1b, r1bm);\n-        MAKE_3DVECTOR(p22, r2a, r2am);\n-        MAKE_3DVECTOR(p22, r2b, r2bm);\n-\n-        alpha = Mtx::Angle(r1am, r2bm);\n-        beta = Mtx::Angle(r1bm, r2am);\n-\n-        // check to see which of the four tangent points should be chosen by seeing which\n-        // ones are on the \'active\' portion of the cylinder. If r1a and r1b are both on or\n-        // both off the active portion, then use r2a and r2b to decide.\n-        if (DSIGN(r1a[_wrapAxis]) == _wrapSign && DSIGN(r1b[_wrapAxis]) == _wrapSign)\n-        {\n-            if (DSIGN(r2a[_wrapAxis]) == _wrapSign)\n-            {\n-                COPY_1X3VECTOR(r1b, aWrapResult.r1);\n-                COPY_1X3VECTOR(r2a, aWrapResult.r2);\n-                if (alpha > beta)\n-                    far_side_wrap = false;\n-                else\n-                    far_side_wrap = true;\n-            }\n-            else\n-            {\n-                COPY_1X3VECTOR(r1a, aWrapResult.r1);\n-                COPY_1X3VECTOR(r2b, aWrapResult.r2);\n-                if (alpha > beta)\n-                    far_side_wrap = true;\n-                else\n-                    far_side_wrap = false;\n-            }\n-        }\n-        else if (DSIGN(r1a[_wrapAxis]) == _wrapSign && DSIGN(r1b[_wrapAxis]) != _wrapSign)\n-        {\n-            COPY_1X3VECTOR(r1a, aWrapResult.r1);\n-            COPY_1X3VECTOR(r2b, aWrapResult.r2);\n-            if (alpha > beta)\n-                far_side_wrap = true;\n-            else\n-                far_side_wrap = false;\n-        }\n-        else if (DSIGN(r1a[_wrapAxis]) != _wrapSign && DSIGN(r1b[_wrapAxis]) == _wrapSign)\n-        {\n-            COPY_1X3VECTOR(r1b, aWrapResult.r1);\n-            COPY_1X3VECTOR(r2a, aWrapResult.r2);\n-            if (alpha > beta)\n-                far_side_wrap = false;\n-            else\n-                far_side_wrap = true;\n-        }\n-        else if (DSIGN(r1a[_wrapAxis]) != _wrapSign && DSIGN(r1b[_wrapAxis]) != _wrapSign)\n-        {\n-            if (DSIGN(r2a[_wrapAxis]) == _wrapSign)\n-            {\n-                COPY_1X3VECTOR(r1b, aWrapResult.r1);\n-                COPY_1X3VECTOR(r2a, aWrapResult.r2);\n-                if (alpha > beta)\n-                    far_side_wrap = false;\n-                else\n-                    far_side_wrap = true;\n-            }\n-            else if (DSIGN(r2b[_wrapAxis]) == _wrapSign)\n-            {\n-                COPY_1X3VECTOR(r1a, aWrapResult.r1);\n-                COPY_1X3VECTOR(r2b, aWrapResult.r2);\n-                if (alpha > beta)\n-                    far_side_wrap = true;\n-                else\n-                    far_side_wrap = false;\n-            }\n-            else // none of the four tangent points is on the active portion\n-            {\n-                if (alpha > beta)\n-                {\n-                    COPY_1X3VECTOR(r1a, aWrapResult.r1);\n-                    COPY_1X3VECTOR(r2b, aWrapResult.r2);\n-                    far_side_wrap = true;\n-                }\n-                else\n-                {\n-                    COPY_1X3VECTOR(r1b, aWrapResult.r1);\n-                    COPY_1X3VECTOR(r2a, aWrapResult.r2);\n-                    far_side_wrap = true;\n-                }\n-            }\n-        }\n-        // determine if the resulting tangent points create a short wrap\n-        // (less than half the cylinder) or a long wrap.\n-        for (i = 0; i < 3; i++)\n-        {\n-            sum_musc[i] = (aWrapResult.r1[i] - aPoint1[i]) + (aWrapResult.r2[i] - aPoint2[i]);\n-            sum_r[i] = (aWrapResult.r1[i] - p11[i]) + (aWrapResult.r2[i] - p22[i]);\n-        }\n-\n-        if (Mtx::DotProduct(3, sum_r, sum_musc) < 0.0)\n-            long_wrap = true;\n-    }\n-    else\n-    {\n-        MAKE_3DVECTOR(p11, r1a, r1am);\n-        MAKE_3DVECTOR(p11, r1b, r1bm);\n-        MAKE_3DVECTOR(p22, r2a, r2am);\n-        MAKE_3DVECTOR(p22, r2b, r2bm);\n-\n-        Mtx::Normalize(3, r1am, r1am);\n-        Mtx::Normalize(3, r1bm, r1bm);\n-        Mtx::Normalize(3, r2am, r2am);\n-        Mtx::Normalize(3, r2bm, r2bm);\n-\n-        dot1 = Mtx::DotProduct(3, r1am, r2am);\n-        dot2 = Mtx::DotProduct(3, r1am, r2bm);\n-        dot3 = Mtx::DotProduct(3, r1bm, r2am);\n-        dot4 = Mtx::DotProduct(3, r1bm, r2bm);\n-\n-        if (dot1 > dot2 && dot1 > dot3 && dot1 > dot4)\n-        {\n-            COPY_1X3VECTOR(r1a, aWrapResult.r1);\n-            COPY_1X3VECTOR(r2a, aWrapResult.r2);\n-            r11 = &r1b[0];\n-            r22 = &r2b[0];\n-        }\n-        else if (dot2 > dot3 && dot2 > dot4)\n-        {\n-            COPY_1X3VECTOR(r1a, aWrapResult.r1);\n-            COPY_1X3VECTOR(r2b, aWrapResult.r2);\n-            r11 = &r1b[0];\n-            r22 = &r2a[0];\n-        }\n-        else if (dot3 > dot4)\n-        {\n-            COPY_1X3VECTOR(r1b, aWrapResult.r1);\n-            COPY_1X3VECTOR(r2a, aWrapResult.r2);\n-            r11 = &r1a[0];\n-            r22 = &r2b[0];\n-        }\n-        else\n-        {\n-            COPY_1X3VECTOR(r1b, aWrapResult.r1);\n-            COPY_1X3VECTOR(r2b, aWrapResult.r2);\n-            r11 = &r1a[0];\n-            r22 = &r2a[0];\n-        }\n-    }\n-\n-    // bisect angle between r1 & r2 vectors to find the apex edge of the\n-    // cylinder:\n-    MAKE_3DVECTOR(p11, aWrapResult.r1, uu);\n-    MAKE_3DVECTOR(p22, aWrapResult.r2, vv);\n-\n-    for (i = 0; i < 3; i++)\n-        vv[i] = uu[i] + vv[i];\n-\n-    Mtx::Normalize(3, vv, vv);\n-\n-    // find the apex point by using a ratio of the lengths of the\n-    // aPoint1-p11 and aPoint2-p22 segments:\n-    t = p11_dist / (p11_dist + p22_dist);\n-\n-    // find point along muscle line according to calculated t value\n-    for (i = 0; i < 3; i++)\n-        mpt[i] = aPoint1[i] + t * (aPoint2[i] - aPoint1[i]);\n-\n-    // find closest point on cylinder axis to mpt\n-    WrapMath::GetClosestPointOnLineToPoint(mpt, p0, dn, axispt, t);\n-\n-    // find normal of plane through aPoint1, aPoint2, axispt\n-    MAKE_3DVECTOR(axispt, aPoint1, l1);\n-    MAKE_3DVECTOR(axispt, aPoint2, l2);\n-\n-    Mtx::Normalize(3, l1, l1);\n-    Mtx::Normalize(3, l2, l2);\n-\n-    Mtx::CrossProduct(l1, l2, plane_normal);\n-    Mtx::Normalize(3, plane_normal, plane_normal);\n-\n-    // cross plane normal and cylinder axis (each way) to\n-    // get vectors pointing from axispt towards mpt and\n-    // away from mpt (you can\'t tell which is which yet).\n-    Mtx::CrossProduct(dn, plane_normal, vert1);\n-    Mtx::Normalize(3, vert1, vert1);\n-    Mtx::CrossProduct(plane_normal, dn, vert2);\n-    Mtx::Normalize(3, vert2, vert2);\n-\n-    // now find two potential apex points, one along each vector\n-    for (i = 0; i < 3; i++)\n-    {\n-        apex1[i] = axispt[i] + _radius * vert1[i];\n-        apex2[i] = axispt[i] + _radius * vert2[i];\n-    }\n-\n-    // Now use the distance from these points to mpt to\n-    // pick the right one.\n-    dist1 = WrapMath::CalcDistanceSquaredBetweenPoints(mpt, apex1);\n-    dist2 = WrapMath::CalcDistanceSquaredBetweenPoints(mpt, apex2);\n-    if (far_side_wrap)\n-    {\n-        if (dist1 < dist2)\n-        {\n-            for (i = 0; i < 3; i++)\n-                apex[i] = apex2[i];\n-        }\n-        else\n-        {\n-            for (i = 0; i < 3; i++)\n-                apex[i] = apex1[i];\n-        }\n-    }\n-    else\n-    {\n-        if (dist1 < dist2)\n-        {\n-            for (i = 0; i < 3; i++)\n-                apex[i] = apex1[i];\n-        }\n-        else\n-        {\n-            for (i = 0; i < 3; i++)\n-                apex[i] = apex2[i];\n-        }\n-    }\n-\n-    // determine how far to slide the preliminary r1/r2 along their\n-    // "edge of tangency" with the cylinder by intersecting the aPoint1-ax\n-    // line with the plane formed by aPoint1, aPoint2, and apex:\n-    MAKE_3DVECTOR(apex, aPoint1, uu);\n-    MAKE_3DVECTOR(apex, aPoint2, vv);\n-\n-    Mtx::Normalize(3, uu, uu);\n-    Mtx::Normalize(3, vv, vv);\n-\n-    Mtx::CrossProduct(uu, vv, plane_normal);\n-    Mtx::Normalize(3, plane_normal, plane_normal);\n-\n-    d = - aPoint1[0] * plane_normal[0] - aPoint1[1] * plane_normal[1] - aPoint1[2] * plane_normal[2];\n-\n-    for (i = 0; i < 3; i++)\n-    {\n-        r1a[i] = aWrapResult.r1[i] - 10.0 * dn[i];\n-        r2a[i] = aWrapResult.r2[i] - 10.0 * dn[i];\n-\n-        r1b[i] = aWrapResult.r1[i] + 10.0 * dn[i];\n-        r2b[i] = aWrapResult.r2[i] + 10.0 * dn[i];\n-    }\n-\n-    r1_inter = WrapMath::IntersectLineSegPlane(r1a, r1b, plane_normal, d, r1p);\n-    r2_inter = WrapMath::IntersectLineSegPlane(r2a, r2b, plane_normal, d, r2p);\n-\n-    if (r1_inter)\n-    {\n-        WrapMath::GetClosestPointOnLineToPoint(r1p, p11, p22, r1a, t);\n-\n-        if (WrapMath::CalcDistanceSquaredBetweenPoints(r1a, p22) < WrapMath::CalcDistanceSquaredBetweenPoints(p11, p22))\n-            for (i = 0; i < 3; i++)\n-                aWrapResult.r1[i] = r1p[i];\n-    }\n-\n-    if (r2_inter)\n-    {\n-        WrapMath::GetClosestPointOnLineToPoint(r2p, p11, p22, r2a, t);\n-\n-        if (WrapMath::CalcDistanceSquaredBetweenPoints(r2a, p11) < WrapMath::CalcDistanceSquaredBetweenPoints(p22, p11))\n-            for (i = 0; i < 3; i++)\n-                aWrapResult.r2[i] = r2p[i];\n-    }\n-\n-    // Now that you have r1 and r2, check to see if they are beyond the\n-    // [display] length of the cylinder. If both are, there should be\n-    // no wrapping. Since the axis of the cylinder is the Z axis, and\n-    // the cylinder is centered on Z=0, check the Z components of r1 and r2\n-    // to see if they are within _length/2.0 of zero.\n-    if ((aWrapResult.r1[2] < -_length/2.0 || aWrapResult.r1[2] > _length/2.0) && (aWrapResult.r2[2] < -_length/2.0 || aWrapResult.r2[2] > _length/2.0))\n-        return noWrap;\n-\n-    // make the path and calculate the muscle length:\n-    _make_spiral_path(aPoint1, aPoint2, long_wrap, aWrapResult);\n-\n-    aFlag = true;\n-\n-    return return_code;\n+\tdouble dist, p11_dist, p22_dist, t, dot1, dot2, dot3, dot4, d, sin_theta,\n+\t\t*r11, *r22, alpha, beta, r_squared = _radius * _radius;\n+\tdouble dist1, dist2;\n+\tdouble t12, t00;\n+\n+\tVec3 pp, vv, uu, r1a, r1b, r2a, r2b, apex, plane_normal, sum_musc, \n+\t\tr1am, r1bm, r2am, r2bm, p11, p22, r1p, r2p, axispt, near12, \n+\t\tvert1, vert2, mpt, apex1, apex2, l1, l2, near00;\n+\n+\tint i, return_code = wrapped;\n+\tbool r1_inter, r2_inter;\n+\tbool constrained   = (bool) (_wrapSign != 0);\n+\tbool far_side_wrap = false, long_wrap = false;\n+\n+\t// In case you need any variables from the previous wrap, copy them from\n+\t// the PathWrap into the WrapResult, re-normalizing the ones that were\n+\t// un-normalized at the end of the previous wrap calculation.\n+\tconst WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n+\taWrapResult.factor = previousWrap.factor;\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\taWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor;\n+\t\taWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor;\n+\t\taWrapResult.c1[i] = previousWrap.c1[i];\n+\t\taWrapResult.sv[i] = previousWrap.sv[i];\n+\t}\n+\n+\taFlag = false;\n+\taWrapResult.wrap_path_length = 0.0;\n+\taWrapResult.wrap_pts.setSize(0);\n+\n+\t// abort if aPoint1 or aPoint2 is inside the cylinder.\n+\tif (WrapMath::CalcDistanceSquaredPointToLine(aPoint1, p0, dn) < r_squared ||\n+\t\tWrapMath::CalcDistanceSquaredPointToLine(aPoint2, p0, dn) < r_squared)\n+\t{\n+\t\treturn insideRadius;\n+\t}\n+\n+\t// Find the closest intersection between the muscle line segment and the line\n+\t// segment from one end of the cylinder to the other. This intersection is\n+\t// used in several places further down in the code to check for various\n+\t// wrapping conditions.\n+\tSimTK::Vec3 cylStart, cylEnd;\n+\tcylStart[0] = cylEnd[0] = 0.0;\n+\tcylStart[1] = cylEnd[1] = 0.0;\n+\tcylStart[2] = -0.5 * _length;\n+\tcylEnd[2] = 0.5 * _length;\n+\n+\tWrapMath::IntersectLines(aPoint1, aPoint2, cylStart, cylEnd, near12, t12, near00, t00);\n+\n+\t// abort if the cylinder is unconstrained and p1p2 misses the cylinder.\n+\t// Use the return values from the above call to IntersectLines()\n+\t// to perform the check.\n+\tif ( ! constrained)\n+\t{\n+\t\tif (WrapMath::CalcDistanceSquaredBetweenPoints(near12, near00) < r_squared && t12 > 0.0 && t12 < 1.0)\n+\t\t{\n+\t\t\treturn_code = mandatoryWrap;\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\treturn noWrap;\n+\t\t}\n+\t}\n+\n+\t// find points p11 & p22 on the cylinder axis closest aPoint1 & aPoint2\n+\tWrapMath::GetClosestPointOnLineToPoint(aPoint1, p0, dn, p11, t);\n+\tWrapMath::GetClosestPointOnLineToPoint(aPoint2, p0, dn, p22, t);\n+\n+\t// find preliminary tangent point candidates r1a & r1b\n+\tMAKE_3DVECTOR(p11, aPoint1, vv);\n+\n+\tp11_dist = Mtx::Normalize(3, vv, vv);\n+\n+\tsin_theta = _radius / p11_dist;\n+\n+\tdist = _radius * sin_theta;\n+\n+\tfor (i = 0; i < 3; i++)\n+\t\tpp[i] = p11[i] + dist * vv[i];\n+\n+\tdist = sqrt(r_squared - dist * dist);\n+\n+\tMtx::CrossProduct(dn, vv, uu);\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tr1a[i] = pp[i] + dist * uu[i];\n+\t\tr1b[i] = pp[i] - dist * uu[i];\n+\t}\n+\n+\t// find preliminary tangent point candidates r2a & r2b\n+\tMAKE_3DVECTOR(p22, aPoint2, vv);\n+\n+\tp22_dist = Mtx::Normalize(3, vv, vv);\n+\n+\tsin_theta = _radius / p22_dist;\n+\n+\tdist = _radius * sin_theta;\n+\n+\tfor (i = 0; i < 3; i++)\n+\t\tpp[i] = p22[i] + dist * vv[i];\n+\n+\tdist = sqrt(r_squared - dist * dist);\n+\n+\tMtx::CrossProduct(dn, vv, uu);\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tr2a[i] = pp[i] + dist * uu[i];\n+\t\tr2b[i] = pp[i] - dist * uu[i];\n+\t}\n+\n+\t// choose the best preliminary tangent points r1 & r2 from the 4 candidates.\n+\tif (constrained)\n+\t{\n+\t\tSimTK::Vec3 sum_r;\n+\n+\t\tif (DSIGN(aPoint1[_wrapAxis]) == _wrapSign || DSIGN(aPoint2[_wrapAxis]) == _wrapSign)\n+\t\t{\n+\t\t\t// If either muscle point is on the constrained side, then check for intersection\n+\t\t\t// of the muscle line and the cylinder. If there is an intersection, then\n+\t\t\t// you\'ve found a mandatory wrap. If not, then if one point is not on the constrained\n+\t\t\t// side and the closest point on the line is not on the constrained side, you\'ve\n+\t\t\t// found a potential wrap. Otherwise, there is no wrap.\n+\t\t\t// Use the return values from the previous call to IntersectLines()\n+\t\t\t// to perform these checks.\n+\t\t\tif (WrapMath::CalcDistanceSquaredBetweenPoints(near12, near00) < r_squared && t12 > 0.0 && t12 < 1.0)\n+\t\t\t{\n+\t\t\t\treturn_code = mandatoryWrap;\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tif (DSIGN(aPoint1[_wrapAxis]) != DSIGN(aPoint2[_wrapAxis]) && DSIGN(near12[_wrapAxis]) != _wrapSign)\n+\t\t\t\t{\n+\t\t\t\t\treturn_code = wrapped;\n+\t\t\t\t}\n+\t\t\t\telse\n+\t\t\t\t{\n+\t\t\t\t\treturn noWrap;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n+\t\tMAKE_3DVECTOR(p11, r1a, r1am);\n+\t\tMAKE_3DVECTOR(p11, r1b, r1bm);\n+\t\tMAKE_3DVECTOR(p22, r2a, r2am);\n+\t\tMAKE_3DVECTOR(p22, r2b, r2bm);\n+\n+\t\talpha = Mtx::Angle(r1am, r2bm);\n+\t\tbeta = Mtx::Angle(r1bm, r2am);\n+\n+\t\t// check to see which of the four tangent points should be chosen by seeing which\n+\t\t// ones are on the \'active\' portion of the cylinder. If r1a and r1b are both on or\n+\t\t// both off the active portion, then use r2a and r2b to decide.\n+\t\tif (DSIGN(r1a[_wrapAxis]) == _wrapSign && DSIGN(r1b[_wrapAxis]) == _wrapSign)\n+\t\t{\n+\t\t\tif (DSIGN(r2a[_wrapAxis]) == _wrapSign)\n+\t\t\t{\n+\t\t\t\tCOPY_1X3VECTOR(r1b, aWrapResult.r1);\n+\t\t\t\tCOPY_1X3VECTOR(r2a, aWrapResult.r2);\n+\t\t\t\tif (alpha > beta)\n+\t\t\t\t\tfar_side_wrap = false;\n+\t\t\t\telse\n+\t\t\t\t\tfar_side_wrap = true;\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tCOPY_1X3VECTOR(r1a, aWrapResult.r1);\n+\t\t\t\tCOPY_1X3VECTOR(r2b, aWrapResult.r2);\n+\t\t\t\tif (alpha > beta)\n+\t\t\t\t\tfar_side_wrap = true;\n+\t\t\t\telse\n+\t\t\t\t\tfar_side_wrap = false;\n+\t\t\t}\n+\t\t}\n+\t\telse if (DSIGN(r1a[_wrapAxis]) == _wrapSign && DSIGN(r1b[_wrapAxis]) != _wrapSign)\n+\t\t{\n+\t\t\tCOPY_1X3VECTOR(r1a, aWrapResult.r1);\n+\t\t\tCOPY_1X3VECTOR(r2b, aWrapResult.r2);\n+\t\t\tif (alpha > beta)\n+\t\t\t\tfar_side_wrap = true;\n+\t\t\telse\n+\t\t\t\tfar_side_wrap = false;\n+\t\t}\n+\t\telse if (DSIGN(r1a[_wrapAxis]) != _wrapSign && DSIGN(r1b[_wrapAxis]) == _wrapSign)\n+\t\t{\n+\t\t\tCOPY_1X3VECTOR(r1b, aWrapResult.r1);\n+\t\t\tCOPY_1X3VECTOR(r2a, aWrapResult.r2);\n+\t\t\tif (alpha > beta)\n+\t\t\t\tfar_side_wrap = false;\n+\t\t\telse\n+\t\t\t\tfar_side_wrap = true;\n+\t\t}\n+\t\telse if (DSIGN(r1a[_wrapAxis]) != _wrapSign && DSIGN(r1b[_wrapAxis]) != _wrapSign)\n+\t\t{\n+\t\t\tif (DSIGN(r2a[_wrapAxis]) == _wrapSign)\n+\t\t\t{\n+\t\t\t\tCOPY_1X3VECTOR(r1b, aWrapResult.r1);\n+\t\t\t\tCOPY_1X3VECTOR(r2a, aWrapResult.r2);\n+\t\t\t\tif (alpha > beta)\n+\t\t\t\t\tfar_side_wrap = false;\n+\t\t\t\telse\n+\t\t\t\t\tfar_side_wrap = true;\n+\t\t\t}\n+\t\t\telse if (DSIGN(r2b[_wrapAxis]) == _wrapSign)\n+\t\t\t{\n+\t\t\t\tCOPY_1X3VECTOR(r1a, aWrapResult.r1);\n+\t\t\t\tCOPY_1X3VECTOR(r2b, aWrapResult.r2);\n+\t\t\t\tif (alpha > beta)\n+\t\t\t\t\tfar_side_wrap = true;\n+\t\t\t\telse\n+\t\t\t\t\tfar_side_wrap = false;\n+\t\t\t}\n+\t\t\telse // none of the four tangent points is on the active portion\n+\t\t\t{\n+\t\t\t\tif (alpha > beta)\n+\t\t\t\t{\n+\t\t\t\t\tCOPY_1X3VECTOR(r1a, aWrapResult.r1);\n+\t\t\t\t\tCOPY_1X3VECTOR(r2b, aWrapResult.r2);\n+\t\t\t\t\tfar_side_wrap = true;\n+\t\t\t\t}\n+\t\t\t\telse\n+\t\t\t\t{\n+\t\t\t\t\tCOPY_1X3VECTOR(r1b, aWrapResult.r1);\n+\t\t\t\t\tCOPY_1X3VECTOR(r2a, aWrapResult.r2);\n+\t\t\t\t\tfar_side_wrap = true;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t\t// determine if the resulting tangent points create a short wrap\n+\t\t// (less than half the cylinder) or a long wrap.\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t{\n+\t\t\tsum_musc[i] = (aWrapResult.r1[i] - aPoint1[i]) + (aWrapResult.r2[i] - aPoint2[i]);\n+\t\t\tsum_r[i] = (aWrapResult.r1[i] - p11[i]) + (aWrapResult.r2[i] - p22[i]);\n+\t\t}\n+\n+\t\tif (Mtx::DotProduct(3, sum_r, sum_musc) < 0.0)\n+\t\t\tlong_wrap = true;\n+\t}\n+\telse\n+\t{\n+\t\tMAKE_3DVECTOR(p11, r1a, r1am);\n+\t\tMAKE_3DVECTOR(p11, r1b, r1bm);\n+\t\tMAKE_3DVECTOR(p22, r2a, r2am);\n+\t\tMAKE_3DVECTOR(p22, r2b, r2bm);\n+\n+\t\tMtx::Normalize(3, r1am, r1am);\n+\t\tMtx::Normalize(3, r1bm, r1bm);\n+\t\tMtx::Normalize(3, r2am, r2am);\n+\t\tMtx::Normalize(3, r2bm, r2bm);\n+\n+\t\tdot1 = Mtx::DotProduct(3, r1am, r2am);\n+\t\tdot2 = Mtx::DotProduct(3, r1am, r2bm);\n+\t\tdot3 = Mtx::DotProduct(3, r1bm, r2am);\n+\t\tdot4 = Mtx::DotProduct(3, r1bm, r2bm);\n+\n+\t\tif (dot1 > dot2 && dot1 > dot3 && dot1 > dot4)\n+\t\t{\n+\t\t\tCOPY_1X3VECTOR(r1a, aWrapResult.r1);\n+\t\t\tCOPY_1X3VECTOR(r2a, aWrapResult.r2);\n+\t\t\tr11 = &r1b[0];\n+\t\t\tr22 = &r2b[0];\n+\t\t}\n+\t\telse if (dot2 > dot3 && dot2 > dot4)\n+\t\t{\n+\t\t\tCOPY_1X3VECTOR(r1a, aWrapResult.r1);\n+\t\t\tCOPY_1X3VECTOR(r2b, aWrapResult.r2);\n+\t\t\tr11 = &r1b[0];\n+\t\t\tr22 = &r2a[0];\n+\t\t}\n+\t\telse if (dot3 > dot4)\n+\t\t{\n+\t\t\tCOPY_1X3VECTOR(r1b, aWrapResult.r1);\n+\t\t\tCOPY_1X3VECTOR(r2a, aWrapResult.r2);\n+\t\t\tr11 = &r1a[0];\n+\t\t\tr22 = &r2b[0];\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tCOPY_1X3VECTOR(r1b, aWrapResult.r1);\n+\t\t\tCOPY_1X3VECTOR(r2b, aWrapResult.r2);\n+\t\t\tr11 = &r1a[0];\n+\t\t\tr22 = &r2a[0];\n+\t\t}\n+\t}\n+\n+\t// bisect angle between r1 & r2 vectors to find the apex edge of the\n+\t// cylinder:\n+\tMAKE_3DVECTOR(p11, aWrapResult.r1, uu);\n+\tMAKE_3DVECTOR(p22, aWrapResult.r2, vv);\n+\n+\tfor (i = 0; i < 3; i++)\n+\t\tvv[i] = uu[i] + vv[i];\n+\n+\tMtx::Normalize(3, vv, vv);\n+\n+\t// find the apex point by using a ratio of the lengths of the\n+\t// aPoint1-p11 and aPoint2-p22 segments:\n+\tt = p11_dist / (p11_dist + p22_dist);\n+\n+\t// find point along muscle line according to calculated t value\n+\tfor (i = 0; i < 3; i++)\n+\t\tmpt[i] = aPoint1[i] + t * (aPoint2[i] - aPoint1[i]);\n+\n+\t// find closest point on cylinder axis to mpt\n+\tWrapMath::GetClosestPointOnLineToPoint(mpt, p0, dn, axispt, t);\n+\n+\t// find normal of plane through aPoint1, aPoint2, axispt\n+\tMAKE_3DVECTOR(axispt, aPoint1, l1);\n+\tMAKE_3DVECTOR(axispt, aPoint2, l2);\n+\n+\tMtx::Normalize(3, l1, l1);\n+\tMtx::Normalize(3, l2, l2);\n+\n+\tMtx::CrossProduct(l1, l2, plane_normal);\n+\tMtx::Normalize(3, plane_normal, plane_normal);\n+\n+\t// cross plane normal and cylinder axis (each way) to\n+\t// get vectors pointing from axispt towards mpt and\n+\t// away from mpt (you can\'t tell which is which yet).\n+\tMtx::CrossProduct(dn, plane_normal, vert1);\n+\tMtx::Normalize(3, vert1, vert1);\n+\tMtx::CrossProduct(plane_normal, dn, vert2);\n+\tMtx::Normalize(3, vert2, vert2);\n+\n+\t// now find two potential apex points, one along each vector\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tapex1[i] = axispt[i] + _radius * vert1[i];\n+\t\tapex2[i] = axispt[i] + _radius * vert2[i];\n+\t}\n+\n+\t// Now use the distance from these points to mpt to\n+\t// pick the right one.\n+\tdist1 = WrapMath::CalcDistanceSquaredBetweenPoints(mpt, apex1);\n+\tdist2 = WrapMath::CalcDistanceSquaredBetweenPoints(mpt, apex2);\n+\tif (far_side_wrap)\n+\t{\n+\t\tif (dist1 < dist2)\n+\t\t{\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tapex[i] = apex2[i];\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tapex[i] = apex1[i];\n+\t\t}\n+\t}\n+\telse\n+\t{\n+\t\tif (dist1 < dist2)\n+\t\t{\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tapex[i] = apex1[i];\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tapex[i] = apex2[i];\n+\t\t}\n+\t}\n+\n+\t// determine how far to slide the preliminary r1/r2 along their\n+\t// "edge of tangency" with the cylinder by intersecting the aPoint1-ax\n+\t// line with the plane formed by aPoint1, aPoint2, and apex:\n+\tMAKE_3DVECTOR(apex, aPoint1, uu);\n+\tMAKE_3DVECTOR(apex, aPoint2, vv);\n+\n+\tMtx::Normalize(3, uu, uu);\n+\tMtx::Normalize(3, vv, vv);\n+\n+\tMtx::CrossProduct(uu, vv, plane_normal);\n+\tMtx::Normalize(3, plane_normal, plane_normal);\n+\n+\td = - aPoint1[0] * plane_normal[0] - aPoint1[1] * plane_normal[1] - aPoint1[2] * plane_normal[2];\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tr1a[i] = aWrapResult.r1[i] - 10.0 * dn[i];\n+\t\tr2a[i] = aWrapResult.r2[i] - 10.0 * dn[i];\n+\n+\t\tr1b[i] = aWrapResult.r1[i] + 10.0 * dn[i];\n+\t\tr2b[i] = aWrapResult.r2[i] + 10.0 * dn[i];\n+\t}\n+\n+\tr1_inter = WrapMath::IntersectLineSegPlane(r1a, r1b, plane_normal, d, r1p);\n+\tr2_inter = WrapMath::IntersectLineSegPlane(r2a, r2b, plane_normal, d, r2p);\n+\n+\tif (r1_inter)\n+\t{\n+\t\tWrapMath::GetClosestPointOnLineToPoint(r1p, p11, p22, r1a, t);\n+\n+\t\tif (WrapMath::CalcDistanceSquaredBetweenPoints(r1a, p22) < WrapMath::CalcDistanceSquaredBetweenPoints(p11, p22))\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\taWrapResult.r1[i] = r1p[i];\n+\t}\n+\n+\tif (r2_inter)\n+\t{\n+\t\tWrapMath::GetClosestPointOnLineToPoint(r2p, p11, p22, r2a, t);\n+\n+\t\tif (WrapMath::CalcDistanceSquaredBetweenPoints(r2a, p11) < WrapMath::CalcDistanceSquaredBetweenPoints(p22, p11))\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\taWrapResult.r2[i] = r2p[i];\n+\t}\n+\n+\t// Now that you have r1 and r2, check to see if they are beyond the\n+\t// [display] length of the cylinder. If both are, there should be\n+\t// no wrapping. Since the axis of the cylinder is the Z axis, and\n+\t// the cylinder is centered on Z=0, check the Z components of r1 and r2\n+\t// to see if they are within _length/2.0 of zero.\n+\tif ((aWrapResult.r1[2] < -_length/2.0 || aWrapResult.r1[2] > _length/2.0) && (aWrapResult.r2[2] < -_length/2.0 || aWrapResult.r2[2] > _length/2.0))\n+\t\treturn noWrap;\n+\n+\t// make the path and calculate the muscle length:\n+\t_make_spiral_path(aPoint1, aPoint2, long_wrap, aWrapResult);\n+\n+\taFlag = true;\n+\n+\treturn return_code;\n \n }\n \n@@ -685,96 +684,96 @@ int WrapCylinder::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::V\n  * @param aWrapResult The result of the wrapping (tangent points, etc.)\n  */\n void WrapCylinder::_make_spiral_path(SimTK::Vec3& aPoint1,\n-                                                 SimTK::Vec3& aPoint2,\n-                                                 bool far_side_wrap,\n-                                                 WrapResult& aWrapResult) const\n+\t\t\t\t\t\t\t\t\t\t\t\t SimTK::Vec3& aPoint2,\n+\t\t\t\t\t\t\t\t\t\t\t\t bool far_side_wrap,\n+\t\t\t\t\t\t\t\t\t\t\t\t WrapResult& aWrapResult) const\n {\n-    double x, y, t, axial_dist, theta;\n-    Vec3 r1a, r2a, uu, vv, ax, axial_vec, wrap_pt;\n-    double sense = far_side_wrap ? -1.0 : 1.0;\n-    double m[4][4];\n-    int i, iterations = 0;\n+\tdouble x, y, t, axial_dist, theta;\n+\tVec3 r1a, r2a, uu, vv, ax, axial_vec, wrap_pt;\n+\tdouble sense = far_side_wrap ? -1.0 : 1.0;\n+\tdouble m[4][4];\n+\tint i, iterations = 0;\n \n restart_spiral_wrap:\n \n-    aWrapResult.wrap_pts.setSize(0);\n+\taWrapResult.wrap_pts.setSize(0);\n \n-    // determine the axial vector\n+\t// determine the axial vector\n \n-    WrapMath::GetClosestPointOnLineToPoint(aWrapResult.r1, p0, dn, r1a, t);\n-    WrapMath::GetClosestPointOnLineToPoint(aWrapResult.r2, p0, dn, r2a, t);\n+\tWrapMath::GetClosestPointOnLineToPoint(aWrapResult.r1, p0, dn, r1a, t);\n+\tWrapMath::GetClosestPointOnLineToPoint(aWrapResult.r2, p0, dn, r2a, t);\n \n-    MAKE_3DVECTOR(r1a, r2a, axial_vec);\n+\tMAKE_3DVECTOR(r1a, r2a, axial_vec);\n \n-    axial_dist = Mtx::Magnitude(3, axial_vec);\n+\taxial_dist = Mtx::Magnitude(3, axial_vec);\n \n-    // determine the radial angle\n-    MAKE_3DVECTOR(r1a, aWrapResult.r1, uu);\n-    MAKE_3DVECTOR(r2a, aWrapResult.r2, vv);\n+\t// determine the radial angle\n+\tMAKE_3DVECTOR(r1a, aWrapResult.r1, uu);\n+\tMAKE_3DVECTOR(r2a, aWrapResult.r2, vv);\n \n-    for (i = 0; i < 3; i++)\n-    {\n-        uu[i] /= _radius;\n-        vv[i] /= _radius;\n-    }\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tuu[i] /= _radius;\n+\t\tvv[i] /= _radius;\n+\t}\n \n-    theta = Mtx::Angle(uu,vv);\n+\ttheta = Mtx::Angle(uu,vv);\n \n-    if (far_side_wrap)\n-        theta = 2.0 * SimTK_PI - theta;\n+\tif (far_side_wrap)\n+\t\ttheta = 2.0 * SimTK_PI - theta;\n \n-    // use pythagorus to calculate the length of the spiral path (imaging\n-    // a right triangle wrapping around the surface of a cylinder)\n-    x = _radius * theta;\n-    y = axial_dist;\n+\t// use pythagorus to calculate the length of the spiral path (imaging\n+\t// a right triangle wrapping around the surface of a cylinder)\n+\tx = _radius * theta;\n+\ty = axial_dist;\n \n-    aWrapResult.wrap_path_length = sqrt(x * x + y * y);\n+\taWrapResult.wrap_path_length = sqrt(x * x + y * y);\n \n-    // build path segments\n-    Mtx::CrossProduct(uu, vv, ax);\n-    Mtx::Normalize(3, ax, ax);\n+\t// build path segments\n+\tMtx::CrossProduct(uu, vv, ax);\n+\tMtx::Normalize(3, ax, ax);\n \n-    Mtx::CrossProduct(ax, uu, vv);\n+\tMtx::CrossProduct(ax, uu, vv);\n \n-    m[0][0] = ax[0]; m[0][1] = ax[1]; m[0][2] = ax[2]; m[0][3] = 0.0;\n-    m[1][0] = uu[0]; m[1][1] = uu[1]; m[1][2] = uu[2]; m[1][3] = 0.0;\n-    m[2][0] = vv[0]; m[2][1] = vv[1]; m[2][2] = vv[2]; m[2][3] = 0.0;\n-    m[3][0] = 0.0;   m[3][1] = 0.0;   m[3][2] = 0.0;   m[3][3] = 1.0;\n+\tm[0][0] = ax[0]; m[0][1] = ax[1]; m[0][2] = ax[2]; m[0][3] = 0.0;\n+\tm[1][0] = uu[0]; m[1][1] = uu[1]; m[1][2] = uu[2]; m[1][3] = 0.0;\n+\tm[2][0] = vv[0]; m[2][1] = vv[1]; m[2][2] = vv[2]; m[2][3] = 0.0;\n+\tm[3][0] = 0.0;   m[3][1] = 0.0;   m[3][2] = 0.0;   m[3][3] = 1.0;\n \n-    // Each muscle segment on the surface of the cylinder should be\n-    // 0.002 meters long. This assumes the model is in meters, of course.\n-    int numWrapSegments = (int) (aWrapResult.wrap_path_length / 0.002);\n-    if (numWrapSegments < 1)\n-        numWrapSegments = 1;\n+\t// Each muscle segment on the surface of the cylinder should be\n+\t// 0.002 meters long. This assumes the model is in meters, of course.\n+\tint numWrapSegments = (int) (aWrapResult.wrap_path_length / 0.002);\n+\tif (numWrapSegments < 1)\n+\t\tnumWrapSegments = 1;\n \n-    for (i = 0; i < numWrapSegments; i++)\n-    {\n-        double t = (double) i / numWrapSegments;\n+\tfor (i = 0; i < numWrapSegments; i++)\n+\t{\n+\t\tdouble t = (double) i / numWrapSegments;\n \n-        _calc_spiral_wrap_point(r1a, axial_vec, m, ax, sense, t, theta, wrap_pt);\n+\t\t_calc_spiral_wrap_point(r1a, axial_vec, m, ax, sense, t, theta, wrap_pt);\n \n-        // adjust r1/r2 tangent points if necessary to acheive tangency with\n-        // the spiral path:\n-        if (i == 1 && iterations < MAX_ITERATIONS)\n-        {\n-            bool did_adjust_r2 = false;\n-            bool did_adjust_r1 = _adjust_tangent_point(aPoint1, dn, aWrapResult.r1, wrap_pt);\n+\t\t// adjust r1/r2 tangent points if necessary to acheive tangency with\n+\t\t// the spiral path:\n+\t\tif (i == 1 && iterations < MAX_ITERATIONS)\n+\t\t{\n+\t\t\tbool did_adjust_r2 = false;\n+\t\t\tbool did_adjust_r1 = _adjust_tangent_point(aPoint1, dn, aWrapResult.r1, wrap_pt);\n \n-            SimTK::Vec3 temp_wrap_pt;\n+\t\t\tSimTK::Vec3 temp_wrap_pt;\n \n-            _calc_spiral_wrap_point(r1a, axial_vec, m, ax, sense, 1.0 - t, theta, temp_wrap_pt);\n+\t\t\t_calc_spiral_wrap_point(r1a, axial_vec, m, ax, sense, 1.0 - t, theta, temp_wrap_pt);\n \n-            did_adjust_r2 = _adjust_tangent_point(aPoint2, dn, aWrapResult.r2, temp_wrap_pt);\n+\t\t\tdid_adjust_r2 = _adjust_tangent_point(aPoint2, dn, aWrapResult.r2, temp_wrap_pt);\n \n-            if (did_adjust_r1 || did_adjust_r2)\n-            {\n-                iterations++;\n-                goto restart_spiral_wrap;\n-            }\n-        }\n+\t\t\tif (did_adjust_r1 || did_adjust_r2)\n+\t\t\t{\n+\t\t\t\titerations++;\n+\t\t\t\tgoto restart_spiral_wrap;\n+\t\t\t}\n+\t\t}\n \n-        aWrapResult.wrap_pts.append(wrap_pt);\n-    }\n+\t\taWrapResult.wrap_pts.append(wrap_pt);\n+\t}\n }\n \n //_____________________________________________________________________________\n@@ -791,30 +790,30 @@ restart_spiral_wrap:\n  * @param wrap_pt The new point on the spiral path\n  */\n void WrapCylinder::_calc_spiral_wrap_point(const SimTK::Vec3& r1a,\n-                                                         const SimTK::Vec3& axial_vec,\n-                                                         double m[4][4],\n-                                                         const SimTK::Vec3& axis,\n-                                                         double sense,\n-                                                         double t,\n-                                                         double theta,\n-                                                         SimTK::Vec3& wrap_pt) const\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t const SimTK::Vec3& axial_vec,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t double m[4][4],\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t const SimTK::Vec3& axis,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t double sense,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t double t,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t double theta,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t SimTK::Vec3& wrap_pt) const\n {\n-    double n[4][4];\n-    int i, j;\n+\tdouble n[4][4];\n+\tint i, j;\n \n-    for (i = 0; i < 4; i++)\n-        for (j = 0; j < 4; j++)\n-            n[i][j] = m[i][j];\n+\tfor (i = 0; i < 4; i++)\n+\t\tfor (j = 0; j < 4; j++)\n+\t\t\tn[i][j] = m[i][j];\n \n-    WrapMath::RotateMatrixAxisAngle(n, axis, sense * t * theta);\n+\tWrapMath::RotateMatrixAxisAngle(n, axis, sense * t * theta);\n \n-    for (i = 0; i < 3; i++)\n-    {\n-        double radial_component = _radius * n[1][i];\n-        double axial_component = t * axial_vec[i];\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tdouble radial_component = _radius * n[1][i];\n+\t\tdouble axial_component = t * axial_vec[i];\n \n-        wrap_pt[i] = r1a[i] + radial_component + axial_component;\n-    }\n+\t\twrap_pt[i] = r1a[i] + radial_component + axial_component;\n+\t}\n }\n \n //_____________________________________________________________________________\n@@ -832,42 +831,42 @@ void WrapCylinder::_calc_spiral_wrap_point(const SimTK::Vec3& r1a,\n  * @return Whether or not the point was adjusted\n  */\n bool WrapCylinder::_adjust_tangent_point(SimTK::Vec3& pt1,\n-                                                      SimTK::Vec3& dn,\n-                                                      SimTK::Vec3& r1,\n-                                                      SimTK::Vec3& w1) const\n+\t\t\t\t\t\t\t\t\t\t\t\t\t  SimTK::Vec3& dn,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t  SimTK::Vec3& r1,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t  SimTK::Vec3& w1) const\n {\n-    SimTK::Vec3 pr_vec, rw_vec;\n-    double alpha, omega, t;\n-    int i;\n-    bool did_adust = false;\n+\tSimTK::Vec3 pr_vec, rw_vec;\n+\tdouble alpha, omega, t;\n+\tint i;\n+\tbool did_adust = false;\n \n-    MAKE_3DVECTOR(pt1, r1, pr_vec);\n-    MAKE_3DVECTOR(r1, w1, rw_vec);\n+\tMAKE_3DVECTOR(pt1, r1, pr_vec);\n+\tMAKE_3DVECTOR(r1, w1, rw_vec);\n \n-    Mtx::Normalize(3, pr_vec, pr_vec);\n-    Mtx::Normalize(3, rw_vec, rw_vec);\n+\tMtx::Normalize(3, pr_vec, pr_vec);\n+\tMtx::Normalize(3, rw_vec, rw_vec);\n \n-    alpha = acos(Mtx::DotProduct(3, pr_vec, dn));\n-    omega = acos(Mtx::DotProduct(3, rw_vec, dn));\n+\talpha = acos(Mtx::DotProduct(3, pr_vec, dn));\n+\tomega = acos(Mtx::DotProduct(3, rw_vec, dn));\n \n-    if (fabs(alpha - omega) > TANGENCY_THRESHOLD)\n-    {\n-        double p1w1_t, p1aw1a_t;\n-        SimTK::Vec3 save, p1a, w1a, p1w1_int, p1aw1a_int;\n+\tif (fabs(alpha - omega) > TANGENCY_THRESHOLD)\n+\t{\n+\t\tdouble p1w1_t, p1aw1a_t;\n+\t\tSimTK::Vec3 save, p1a, w1a, p1w1_int, p1aw1a_int;\n \n-        WrapMath::GetClosestPointOnLineToPoint(pt1, r1, dn, p1a, t);\n-        WrapMath::GetClosestPointOnLineToPoint(w1, r1, dn, w1a, t);\n+\t\tWrapMath::GetClosestPointOnLineToPoint(pt1, r1, dn, p1a, t);\n+\t\tWrapMath::GetClosestPointOnLineToPoint(w1, r1, dn, w1a, t);\n \n-        WrapMath::IntersectLines(pt1, w1, p1a, w1a, p1w1_int, p1w1_t, p1aw1a_int, p1aw1a_t);\n+\t\tWrapMath::IntersectLines(pt1, w1, p1a, w1a, p1w1_int, p1w1_t, p1aw1a_int, p1aw1a_t);\n \n-        for (i = 0; i < 3; i++)\n-        {\n-            save[i] = r1[i];\n-            r1[i] += 1.5 * (p1aw1a_int[i] - r1[i]);\n-        }\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t{\n+\t\t\tsave[i] = r1[i];\n+\t\t\tr1[i] += 1.5 * (p1aw1a_int[i] - r1[i]);\n+\t\t}\n \n-        did_adust = true;\n-    }\n+\t\tdid_adust = true;\n+\t}\n \n-    return did_adust;\n+\treturn did_adust;\n }\ndiff --git a/OpenSim/Simulation/Wrap/WrapCylinder.h b/OpenSim/Simulation/Wrap/WrapCylinder.h\nindex 98778c1c3..0a0498dc1 100644\n--- a/OpenSim/Simulation/Wrap/WrapCylinder.h\n+++ b/OpenSim/Simulation/Wrap/WrapCylinder.h\n@@ -29,13 +29,12 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n+#include <OpenSim/Common/Geometry.h>\n #include "WrapObject.h"\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathPoint;\ndiff --git a/OpenSim/Simulation/Wrap/WrapCylinderObst.cpp b/OpenSim/Simulation/Wrap/WrapCylinderObst.cpp\nindex cc1cf4804..612335c7b 100644\n--- a/OpenSim/Simulation/Wrap/WrapCylinderObst.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapCylinderObst.cpp\n@@ -41,7 +41,7 @@ static const double TwoPi = 2.0*SimTK::Pi;\n static const double max_wrap_pts_circle_ang = (5.0/360.0)*TwoPi;\n \n // The following variables could be used for speedy wrap_pts definitions (NOT CURRENTLY USED)\n-static const int num_circle_wrap_pts = 36;  // Number of circle points in 360 degrees\n+static const int num_circle_wrap_pts = 36;\t// Number of circle points in 360 degrees\n static double circle_wrap_pts_sin[num_circle_wrap_pts];\n static double circle_wrap_pts_cos[num_circle_wrap_pts];\n static bool circle_wrap_pts_inited = false;\n@@ -59,8 +59,8 @@ _radius(_radiusProp.getValueDbl()),\n _wrapDirectionName(_wrapDirectionNameProp.getValueStr()),\n _length(_lengthProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -83,9 +83,9 @@ _radius(_radiusProp.getValueDbl()),\n _wrapDirectionName(_wrapDirectionNameProp.getValueStr()),\n _length(_lengthProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapCylinderObst);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapCylinderObst);\n }\n \n //=============================================================================\n@@ -97,18 +97,18 @@ _length(_lengthProp.getValueDbl())\n */\n void WrapCylinderObst::setNull()\n {\n-    _wrapDirection = righthand;\n-    if(!circle_wrap_pts_inited) initCircleWrapPts();\n+\t_wrapDirection = righthand;\n+\tif(!circle_wrap_pts_inited) initCircleWrapPts();\n }\n \n /** Initialize static data variables used for speedy definition of wrap_pts (for graphics mainly) */\n void WrapCylinderObst::initCircleWrapPts()\n-{   int i;  double q;\n-    for(i=0; i<num_circle_wrap_pts; i++) {\n-        q = TwoPi*(double)(i)/(double)(num_circle_wrap_pts);\n-        circle_wrap_pts_sin[i] = sin(q);\n-        circle_wrap_pts_cos[i] = cos(q);\n-    }   circle_wrap_pts_inited = true;\n+{\tint i;\tdouble q;\n+\tfor(i=0; i<num_circle_wrap_pts; i++) {\n+\t\tq = TwoPi*(double)(i)/(double)(num_circle_wrap_pts);\n+\t\tcircle_wrap_pts_sin[i] = sin(q);\n+\t\tcircle_wrap_pts_cos[i] = cos(q);\n+\t}\tcircle_wrap_pts_inited = true;\n }\n \n //_____________________________________________________________________________\n@@ -117,20 +117,20 @@ void WrapCylinderObst::initCircleWrapPts()\n */\n void WrapCylinderObst::setupProperties()\n {\n-    // BASE CLASS\n-    WrapObject::setupProperties();\n+\t// BASE CLASS\n+\tWrapObject::setupProperties();\n \n-    _radiusProp.setName("radius");\n-    _radiusProp.setValue(-1.0);\n-    _propertySet.append(&_radiusProp);\n+\t_radiusProp.setName("radius");\n+\t_radiusProp.setValue(-1.0);\n+\t_propertySet.append(&_radiusProp);\n \n-    _wrapDirectionNameProp.setName("wrapDirection");\n-    _wrapDirectionNameProp.setValue("Unassigned");\n-    _propertySet.append(&_wrapDirectionNameProp);\n+\t_wrapDirectionNameProp.setName("wrapDirection");\n+\t_wrapDirectionNameProp.setValue("Unassigned");\n+\t_propertySet.append(&_wrapDirectionNameProp);\n \n-    _lengthProp.setName("length");\n-    _lengthProp.setValue(1.0);\n-    _propertySet.append(&_lengthProp);\n+\t_lengthProp.setName("length");\n+\t_lengthProp.setValue(1.0);\n+\t_propertySet.append(&_lengthProp);\n }\n \n //_____________________________________________________________________________\n@@ -142,33 +142,31 @@ void WrapCylinderObst::setupProperties()\n */\n void WrapCylinderObst::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n {\n-    // Base class\n-    Super::connectToModelAndBody(aModel, aBody);\n-\n-    // maybe set a parent pointer, _body = aBody;\n-    if (_radius < 0.0)\n-    {\n-        string errorMessage = "Error: radius for WrapCylinderObst " + getName() + " was either not specified, or is negative.";\n-        throw Exception(errorMessage);\n-    }\n-\n-    _displayer.freeGeometry();\n-    AnalyticCylinder* cyl = new AnalyticCylinder(_radius, _length);\n-    setGeometryQuadrants(cyl);\n-    _displayer.addGeometry(cyl);\n-\n-    if (_wrapDirectionName == "righthand" || _wrapDirectionName == "right" || _wrapDirectionName == "righthanded" || _wrapDirectionName == "Righthand" || _wrapDirectionName == "Right" || _wrapDirectionName == "Righthanded")\n-        _wrapDirection = righthand;\n-    else\n-    if (_wrapDirectionName == "lefthand"  || _wrapDirectionName == "left"  || _wrapDirectionName == "lefthanded"  || _wrapDirectionName == "Lefthand"  || _wrapDirectionName == "Left"  || _wrapDirectionName == "Lefthanded")\n-        _wrapDirection = lefthand;\n-    else\n-    if (_wrapDirectionName == "Unassigned")  // wrapDirection was not specified in obstacle object definition; use default\n-        { _wrapDirection = righthand;   _wrapDirectionName = "righthand";   }\n-    else {  // wrapDirection was specified incorrectly in obstacle object definition; throw an exception\n-        string errorMessage = "Error: wrapDirection for wrap obstacle " + getName() + " was specified incorrectly.  Use \\"righthand\\" or \\"lefthand\\".";\n-        throw Exception(errorMessage);\n-    }\n+\t// Base class\n+\tSuper::connectToModelAndBody(aModel, aBody);\n+\n+\t// maybe set a parent pointer, _body = aBody;\n+\tif (_radius < 0.0)\n+\t{\n+\t\tstring errorMessage = "Error: radius for WrapCylinderObst " + getName() + " was either not specified, or is negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\n+\tAnalyticCylinder* cyl = new AnalyticCylinder(_radius, _length);\n+\tsetGeometryQuadrants(cyl);\n+\n+\tif (_wrapDirectionName == "righthand" || _wrapDirectionName == "right" || _wrapDirectionName == "righthanded" || _wrapDirectionName == "Righthand" || _wrapDirectionName == "Right" || _wrapDirectionName == "Righthanded")\n+\t\t_wrapDirection = righthand;\n+\telse\n+\tif (_wrapDirectionName == "lefthand"  || _wrapDirectionName == "left"  || _wrapDirectionName == "lefthanded"  || _wrapDirectionName == "Lefthand"  || _wrapDirectionName == "Left"  || _wrapDirectionName == "Lefthanded")\n+\t\t_wrapDirection = lefthand;\n+\telse\n+\tif (_wrapDirectionName == "Unassigned")  // wrapDirection was not specified in obstacle object definition; use default\n+\t\t{ _wrapDirection = righthand;\t_wrapDirectionName = "righthand";\t}\n+\telse {  // wrapDirection was specified incorrectly in obstacle object definition; throw an exception\n+\t\tstring errorMessage = "Error: wrapDirection for wrap obstacle " + getName() + " was specified incorrectly.  Use \\"righthand\\" or \\"lefthand\\".";\n+\t\tthrow Exception(errorMessage);\n+\t}\n \n }\n \n@@ -180,13 +178,13 @@ void WrapCylinderObst::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody\n */\n void WrapCylinderObst::copyData(const WrapCylinderObst& aWrapCylinderObst)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapCylinderObst);\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapCylinderObst);\n \n-    _radius = aWrapCylinderObst._radius;\n-    _length = aWrapCylinderObst._length;\n-    _wrapDirectionName = aWrapCylinderObst._wrapDirectionName;\n-    _wrapDirection = aWrapCylinderObst._wrapDirection;\n+\t_radius = aWrapCylinderObst._radius;\n+\t_length = aWrapCylinderObst._length;\n+\t_wrapDirectionName = aWrapCylinderObst._wrapDirectionName;\n+\t_wrapDirection = aWrapCylinderObst._wrapDirection;\n }\n \n //_____________________________________________________________________________\n@@ -197,7 +195,7 @@ void WrapCylinderObst::copyData(const WrapCylinderObst& aWrapCylinderObst)\n  */\n const char* WrapCylinderObst::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -210,10 +208,10 @@ const char* WrapCylinderObst::getWrapTypeName() const\n  */\n string WrapCylinderObst::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _radius << "\\nheight " << _length;\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _radius << "\\nheight " << _length;\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n \n //=============================================================================\n@@ -227,10 +225,10 @@ string WrapCylinderObst::getDimensionsString() const\n */\n WrapCylinderObst& WrapCylinderObst::operator=(const WrapCylinderObst& aWrapCylinderObst)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapCylinderObst);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapCylinderObst);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //=============================================================================\n@@ -248,58 +246,58 @@ WrapCylinderObst& WrapCylinderObst::operator=(const WrapCylinderObst& aWrapCylin\n  * @return The status, as a WrapAction enum\n  */\n int WrapCylinderObst::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                        const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\tconst PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n-    SimTK::Vec3& aPointP = aPoint1;     double R=0.8*( _wrapDirection==righthand ? _radius : -_radius );\n-    SimTK::Vec3& aPointS = aPoint2;     double Qx,Qy,Qz, Tx,Ty,Tz;\n-\n-    // Initialize return values\n-    aFlag = false;\n-    aWrapResult.wrap_path_length = 0.0;\n-    aWrapResult.wrap_pts.setSize(0);\n-    \n-    // Compute displacements of P and S from cylinder axis\n-    double Px=aPointP[0], Py=aPointP[1], Pz=aPointP[2], dP=Px*Px+Py*Py, rootP=dP-R*R;\n-    double Sx=aPointS[0], Sy=aPointS[1], Sz=aPointS[2], dS=Sx*Sx+Sy*Sy, rootS=dS-R*R;\n-\n-    // Check P and S against cylinder, and compute x and y components of wrap points Q and T\n-    if( rootP<0.0 || rootS<0.0 ) return insideRadius;   // One of P or S lies within the cylinder\n-    dP=R/dP;    rootP=sqrt(rootP);  Qx=(R*Px-rootP*Py)*dP;  Qy=(R*Py+rootP*Px)*dP;\n-    dS=R/dS;    rootS=sqrt(rootS);  Tx=(R*Sx+rootS*Sy)*dS;  Ty=(R*Sy-rootS*Sx)*dS;\n-\n-    // Apply the 180-degree wrapping rule to see if contact is appropriate (i.e. wrap > 180 = no contact)\n-    if( R*(Qx*Ty-Qy*Tx) < 0.0 ) return noWrap;\n-\n-    // Compute respective wrapping segment lengths\n-    double PQ = sqrt( (Qx-Px)*(Qx-Px) + (Qy-Py)*(Qy-Py) );\n-    double TS = sqrt( (Tx-Sx)*(Tx-Sx) + (Ty-Sy)*(Ty-Sy) );\n-    double QtoTang = acos( 1.0 - 0.5*( (Qx-Tx)*(Qx-Tx) + (Qy-Ty)*(Qy-Ty) )/(R*R) );\n-    double QT = R*QtoTang;\n-    if(QT<0.0) QT=-QT;\n-    \n-    // Assign z-axis components of wrap points Q and T\n-    Qz = Pz + (Sz-Pz)*(PQ) / (PQ+TS+QT);\n-    Tz = Sz + (Pz-Sz)*(TS) / (PQ+TS+QT);\n-    \n-    // Register results and return\n-    aFlag = true;\n-    aWrapResult.wrap_path_length = QT;  // PQ + TS + QT;\n-    aWrapResult.r1[0]=Qx;  aWrapResult.r1[1]=Qy;  aWrapResult.r1[2]=Qz;  \n-    aWrapResult.r2[0]=Tx;  aWrapResult.r2[1]=Ty;  aWrapResult.r2[2]=Tz;\n-    \n-    // Generate wrap_pts sequence of points tracing out wrapping path\n-    aWrapResult.wrap_pts.append(aWrapResult.r1);\n-    double Qang=atan2(Qy,Qx);               // Angle of point Q\n-    int i, n=1+ (int)((QtoTang>=0?QtoTang:-QtoTang)/max_wrap_pts_circle_ang);   // Number of angle steps from Q to T angles\n-    double angDelt=(QtoTang)/(double)(n);   // Delta angle for n steps from Q to T angles\n-    for(i=0;i<=n;i++) {\n-        double ang = Qang + i*angDelt;      // Angle ranging from that of Q to that of T\n-        SimTK::Vec3 aPointi( R*cos(ang), R*sin(ang), Qz+(Tz-Qz)*(double)(i)/(double)(n) );\n-        aWrapResult.wrap_pts.append(aPointi);\n-    }\n-    aWrapResult.wrap_pts.append(aWrapResult.r2);\n-\n-    return wrapped;\n+\tSimTK::Vec3& aPointP = aPoint1;\t\tdouble R=0.8*( _wrapDirection==righthand ? _radius : -_radius );\n+\tSimTK::Vec3& aPointS = aPoint2;\t\tdouble Qx,Qy,Qz, Tx,Ty,Tz;\n+\n+\t// Initialize return values\n+\taFlag = false;\n+\taWrapResult.wrap_path_length = 0.0;\n+\taWrapResult.wrap_pts.setSize(0);\n+\t\n+\t// Compute displacements of P and S from cylinder axis\n+\tdouble Px=aPointP[0], Py=aPointP[1], Pz=aPointP[2], dP=Px*Px+Py*Py, rootP=dP-R*R;\n+\tdouble Sx=aPointS[0], Sy=aPointS[1], Sz=aPointS[2], dS=Sx*Sx+Sy*Sy, rootS=dS-R*R;\n+\n+\t// Check P and S against cylinder, and compute x and y components of wrap points Q and T\n+\tif( rootP<0.0 || rootS<0.0 ) return insideRadius;\t// One of P or S lies within the cylinder\n+\tdP=R/dP;\trootP=sqrt(rootP);\tQx=(R*Px-rootP*Py)*dP;\tQy=(R*Py+rootP*Px)*dP;\n+\tdS=R/dS;\trootS=sqrt(rootS);\tTx=(R*Sx+rootS*Sy)*dS;\tTy=(R*Sy-rootS*Sx)*dS;\n+\n+\t// Apply the 180-degree wrapping rule to see if contact is appropriate (i.e. wrap > 180 = no contact)\n+\tif( R*(Qx*Ty-Qy*Tx) < 0.0 ) return noWrap;\n+\n+\t// Compute respective wrapping segment lengths\n+\tdouble PQ = sqrt( (Qx-Px)*(Qx-Px) + (Qy-Py)*(Qy-Py) );\n+\tdouble TS = sqrt( (Tx-Sx)*(Tx-Sx) + (Ty-Sy)*(Ty-Sy) );\n+\tdouble QtoTang = acos( 1.0 - 0.5*( (Qx-Tx)*(Qx-Tx) + (Qy-Ty)*(Qy-Ty) )/(R*R) );\n+\tdouble QT = R*QtoTang;\n+\tif(QT<0.0) QT=-QT;\n+\t\n+\t// Assign z-axis components of wrap points Q and T\n+\tQz = Pz + (Sz-Pz)*(PQ) / (PQ+TS+QT);\n+\tTz = Sz + (Pz-Sz)*(TS) / (PQ+TS+QT);\n+\t\n+\t// Register results and return\n+\taFlag = true;\n+\taWrapResult.wrap_path_length = QT;\t// PQ + TS + QT;\n+\taWrapResult.r1[0]=Qx;  aWrapResult.r1[1]=Qy;  aWrapResult.r1[2]=Qz;  \n+\taWrapResult.r2[0]=Tx;  aWrapResult.r2[1]=Ty;  aWrapResult.r2[2]=Tz;\n+\t\n+\t// Generate wrap_pts sequence of points tracing out wrapping path\n+\taWrapResult.wrap_pts.append(aWrapResult.r1);\n+\tdouble Qang=atan2(Qy,Qx);\t\t\t\t// Angle of point Q\n+\tint i, n=1+ (int)((QtoTang>=0?QtoTang:-QtoTang)/max_wrap_pts_circle_ang);\t// Number of angle steps from Q to T angles\n+\tdouble angDelt=(QtoTang)/(double)(n);\t// Delta angle for n steps from Q to T angles\n+\tfor(i=0;i<=n;i++) {\n+\t\tdouble ang = Qang + i*angDelt;\t\t// Angle ranging from that of Q to that of T\n+\t\tSimTK::Vec3 aPointi( R*cos(ang), R*sin(ang), Qz+(Tz-Qz)*(double)(i)/(double)(n) );\n+\t\taWrapResult.wrap_pts.append(aPointi);\n+\t}\n+\taWrapResult.wrap_pts.append(aWrapResult.r2);\n+\n+\treturn wrapped;\n }\n \n \ndiff --git a/OpenSim/Simulation/Wrap/WrapCylinderObst.h b/OpenSim/Simulation/Wrap/WrapCylinderObst.h\nindex d322891d4..5716d3d20 100644\n--- a/OpenSim/Simulation/Wrap/WrapCylinderObst.h\n+++ b/OpenSim/Simulation/Wrap/WrapCylinderObst.h\n@@ -26,13 +26,11 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n #include <OpenSim/Simulation/Wrap/WrapObject.h>\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class PathPoint;\n class PathWrap;\ndiff --git a/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp b/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp\nindex f47596bd8..a9ef8569e 100644\n--- a/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp\n@@ -64,8 +64,8 @@ _translationVcyl(_translationVcylProp.getValueDblVec()),\n _length(_lengthProp.getValueDbl()),\n _activeState(0)\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -94,9 +94,9 @@ _translationVcyl(_translationVcylProp.getValueDblVec()),\n _length(_lengthProp.getValueDbl()),\n _activeState(0)\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapDoubleCylinderObst);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapDoubleCylinderObst);\n }\n \n \n@@ -109,8 +109,8 @@ _activeState(0)\n */\n void WrapDoubleCylinderObst::setNull()\n {\n-    _wrapUcylDirection = righthand;\n-    _wrapVcylDirection = righthand;\n+\t_wrapUcylDirection = righthand;\n+\t_wrapVcylDirection = righthand;\n }\n \n //_____________________________________________________________________________\n@@ -119,30 +119,30 @@ void WrapDoubleCylinderObst::setNull()\n */\n void WrapDoubleCylinderObst::setupProperties()\n {\n-    // BASE CLASS\n-    WrapObject::setupProperties();\n-\n-    _radiusUcylProp.setName("radiusUcyl");  _radiusUcylProp.setValue(-1.0);     _propertySet.append(&_radiusUcylProp);\n-    _radiusVcylProp.setName("radiusVcyl");  _radiusVcylProp.setValue(-1.0);     _propertySet.append(&_radiusVcylProp);\n-\n-    _wrapUcylDirectionNameProp.setName("wrapUcylDirection");    _wrapUcylDirectionNameProp.setValue("Unassigned");  _propertySet.append(&_wrapUcylDirectionNameProp);\n-    _wrapVcylDirectionNameProp.setName("wrapVcylDirection");    _wrapVcylDirectionNameProp.setValue("Unassigned");  _propertySet.append(&_wrapVcylDirectionNameProp);\n-    _wrapVcylHomeBodyNameProp.setName("wrapVcylHomeBody");  _wrapVcylHomeBodyNameProp.setValue("Unassigned");   _propertySet.append(&_wrapVcylHomeBodyNameProp);\n-\n-    const double defaultRotations[] = {0.0, 0.0, 0.0};\n-    _xyzBodyRotationVcylProp.setName("xyz_body_rotationVcyl");\n-    _xyzBodyRotationVcylProp.setValue(3, defaultRotations);\n-    _propertySet.append(&_xyzBodyRotationVcylProp);\n-\n-    const SimTK::Vec3 defaultTranslations(0.0);\n-    _translationVcylProp.setName("translationVcyl");\n-    _translationVcylProp.setValue(defaultTranslations);\n-    //_translationProp.setAllowableListSize(3);\n-    _propertySet.append(&_translationVcylProp);\n-\n-    _lengthProp.setName("length");\n-    _lengthProp.setValue(1.0);\n-    _propertySet.append(&_lengthProp);\n+\t// BASE CLASS\n+\tWrapObject::setupProperties();\n+\n+\t_radiusUcylProp.setName("radiusUcyl");\t_radiusUcylProp.setValue(-1.0);\t\t_propertySet.append(&_radiusUcylProp);\n+\t_radiusVcylProp.setName("radiusVcyl");\t_radiusVcylProp.setValue(-1.0);\t\t_propertySet.append(&_radiusVcylProp);\n+\n+\t_wrapUcylDirectionNameProp.setName("wrapUcylDirection");\t_wrapUcylDirectionNameProp.setValue("Unassigned");\t_propertySet.append(&_wrapUcylDirectionNameProp);\n+\t_wrapVcylDirectionNameProp.setName("wrapVcylDirection");\t_wrapVcylDirectionNameProp.setValue("Unassigned");\t_propertySet.append(&_wrapVcylDirectionNameProp);\n+\t_wrapVcylHomeBodyNameProp.setName("wrapVcylHomeBody");\t_wrapVcylHomeBodyNameProp.setValue("Unassigned");\t_propertySet.append(&_wrapVcylHomeBodyNameProp);\n+\n+\tconst double defaultRotations[] = {0.0, 0.0, 0.0};\n+\t_xyzBodyRotationVcylProp.setName("xyz_body_rotationVcyl");\n+\t_xyzBodyRotationVcylProp.setValue(3, defaultRotations);\n+\t_propertySet.append(&_xyzBodyRotationVcylProp);\n+\n+\tconst SimTK::Vec3 defaultTranslations(0.0);\n+\t_translationVcylProp.setName("translationVcyl");\n+\t_translationVcylProp.setValue(defaultTranslations);\n+\t//_translationProp.setAllowableListSize(3);\n+\t_propertySet.append(&_translationVcylProp);\n+\n+\t_lengthProp.setName("length");\n+\t_lengthProp.setValue(1.0);\n+\t_propertySet.append(&_lengthProp);\n }\n \n //_____________________________________________________________________________\n@@ -154,61 +154,59 @@ void WrapDoubleCylinderObst::setupProperties()\n */\n void WrapDoubleCylinderObst::connectToModelAndBody(Model& aModel, OpenSim::Body& aBody)\n {\n-    // Base class\n-    Super::connectToModelAndBody(aModel, aBody);\n-\n-    // maybe set a parent pointer, _body = aBody;\n-    if ( (_radiusUcyl<0.0) || (_radiusVcyl < 0.0) )\n-    {\n-        string errorMessage = "Error: radii for WrapDoubleCylinderObst " + getName() + " were either not specified, or one or more is negative.";\n-        throw Exception(errorMessage);\n-    }\n-\n-    _displayer.freeGeometry();\n-    AnalyticCylinder* cyl = new AnalyticCylinder(_radiusUcyl, _length);\n-    setGeometryQuadrants(cyl);\n-    _displayer.addGeometry(cyl);\n-\n-    // Check wrapUcylDirectionName\n-    if (_wrapUcylDirectionName == "righthand" || _wrapUcylDirectionName == "right" || _wrapUcylDirectionName == "righthanded" || _wrapUcylDirectionName == "Righthand" || _wrapUcylDirectionName == "Right" || _wrapUcylDirectionName == "Righthanded")\n-        _wrapUcylDirection = righthand;\n-    else\n-    if (_wrapUcylDirectionName == "lefthand"  || _wrapUcylDirectionName == "left"  || _wrapUcylDirectionName == "lefthanded"  || _wrapUcylDirectionName == "Lefthand"  || _wrapUcylDirectionName == "Left"  || _wrapUcylDirectionName == "Lefthanded")\n-        _wrapUcylDirection = lefthand;\n-    else\n-    if (_wrapUcylDirectionName == "Unassigned")  // wrapDirection was not specified in obstacle object definition; use default\n-        { _wrapUcylDirection = righthand;   _wrapUcylDirectionName = "righthand";   }\n-    else {  // wrapUcylDirection was specified incorrectly in obstacle object definition; throw an exception\n-        string errorMessage = "Error: wrapUcylDirection for wrap obstacle " + getName() + " was specified incorrectly.  Use \\"righthand\\" or \\"lefthand\\".";\n-        throw Exception(errorMessage);\n-    }\n-\n-    // Check wrapVcylDirectionName\n-    if (_wrapVcylDirectionName == "righthand" || _wrapVcylDirectionName == "right" || _wrapVcylDirectionName == "righthanded" || _wrapVcylDirectionName == "Righthand" || _wrapVcylDirectionName == "Right" || _wrapVcylDirectionName == "Righthanded")\n-        _wrapVcylDirection = righthand;\n-    else\n-    if (_wrapVcylDirectionName == "lefthand"  || _wrapVcylDirectionName == "left"  || _wrapVcylDirectionName == "lefthanded"  || _wrapVcylDirectionName == "Lefthand"  || _wrapVcylDirectionName == "Left"  || _wrapVcylDirectionName == "Lefthanded")\n-        _wrapVcylDirection = lefthand;\n-    else\n-    if (_wrapVcylDirectionName == "Unassigned")  // wrapDirection was not specified in obstacle object definition; use default\n-        { _wrapVcylDirection = righthand;   _wrapVcylDirectionName = "righthand";   }\n-    else {  // wrapVcylDirection was specified incorrectly in obstacle object definition; throw an exception\n-        string errorMessage = "Error: wrapVcylDirection for wrap obstacle " + getName() + " was specified incorrectly.  Use \\"righthand\\" or \\"lefthand\\".";\n-        throw Exception(errorMessage);\n-    }\n-    \n-    // Initialize value of _activeState\n-    _activeState = 3;   // By default assume both cylinders are active\n-    _wrapUcylHomeBody = &aBody; // Save this for use in wrapLine\n-    _model = &aModel;   // Save this for use in wrapLine\n-\n-    // Obtain wrapVcylHomeBody based on wrapVcylHomeBodyName\n-    if(!aModel.updBodySet().contains(_wrapVcylHomeBodyName)) {\n-        string errorMessage = "Error: wrapVcylHomeBody " + _wrapVcylHomeBodyName + " for wrap obstacle " + getName() + " was not found in model.";\n-        throw Exception(errorMessage);\n-    }\n-    _wrapVcylHomeBody = &aModel.updBodySet().get(_wrapVcylHomeBodyName);\n-    \n+\t// Base class\n+\tSuper::connectToModelAndBody(aModel, aBody);\n+\n+\t// maybe set a parent pointer, _body = aBody;\n+\tif ( (_radiusUcyl<0.0) || (_radiusVcyl < 0.0) )\n+\t{\n+\t\tstring errorMessage = "Error: radii for WrapDoubleCylinderObst " + getName() + " were either not specified, or one or more is negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\n+\tAnalyticCylinder* cyl = new AnalyticCylinder(_radiusUcyl, _length);\n+\tsetGeometryQuadrants(cyl);\n+\n+\t// Check wrapUcylDirectionName\n+\tif (_wrapUcylDirectionName == "righthand" || _wrapUcylDirectionName == "right" || _wrapUcylDirectionName == "righthanded" || _wrapUcylDirectionName == "Righthand" || _wrapUcylDirectionName == "Right" || _wrapUcylDirectionName == "Righthanded")\n+\t\t_wrapUcylDirection = righthand;\n+\telse\n+\tif (_wrapUcylDirectionName == "lefthand"  || _wrapUcylDirectionName == "left"  || _wrapUcylDirectionName == "lefthanded"  || _wrapUcylDirectionName == "Lefthand"  || _wrapUcylDirectionName == "Left"  || _wrapUcylDirectionName == "Lefthanded")\n+\t\t_wrapUcylDirection = lefthand;\n+\telse\n+\tif (_wrapUcylDirectionName == "Unassigned")  // wrapDirection was not specified in obstacle object definition; use default\n+\t\t{ _wrapUcylDirection = righthand;\t_wrapUcylDirectionName = "righthand";\t}\n+\telse {  // wrapUcylDirection was specified incorrectly in obstacle object definition; throw an exception\n+\t\tstring errorMessage = "Error: wrapUcylDirection for wrap obstacle " + getName() + " was specified incorrectly.  Use \\"righthand\\" or \\"lefthand\\".";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\n+\t// Check wrapVcylDirectionName\n+\tif (_wrapVcylDirectionName == "righthand" || _wrapVcylDirectionName == "right" || _wrapVcylDirectionName == "righthanded" || _wrapVcylDirectionName == "Righthand" || _wrapVcylDirectionName == "Right" || _wrapVcylDirectionName == "Righthanded")\n+\t\t_wrapVcylDirection = righthand;\n+\telse\n+\tif (_wrapVcylDirectionName == "lefthand"  || _wrapVcylDirectionName == "left"  || _wrapVcylDirectionName == "lefthanded"  || _wrapVcylDirectionName == "Lefthand"  || _wrapVcylDirectionName == "Left"  || _wrapVcylDirectionName == "Lefthanded")\n+\t\t_wrapVcylDirection = lefthand;\n+\telse\n+\tif (_wrapVcylDirectionName == "Unassigned")  // wrapDirection was not specified in obstacle object definition; use default\n+\t\t{ _wrapVcylDirection = righthand;\t_wrapVcylDirectionName = "righthand";\t}\n+\telse {  // wrapVcylDirection was specified incorrectly in obstacle object definition; throw an exception\n+\t\tstring errorMessage = "Error: wrapVcylDirection for wrap obstacle " + getName() + " was specified incorrectly.  Use \\"righthand\\" or \\"lefthand\\".";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\t\n+\t// Initialize value of _activeState\n+\t_activeState = 3;\t// By default assume both cylinders are active\n+\t_wrapUcylHomeBody = &aBody;\t// Save this for use in wrapLine\n+\t_model = &aModel;\t// Save this for use in wrapLine\n+\n+\t// Obtain wrapVcylHomeBody based on wrapVcylHomeBodyName\n+\tif(!aModel.updBodySet().contains(_wrapVcylHomeBodyName)) {\n+\t\tstring errorMessage = "Error: wrapVcylHomeBody " + _wrapVcylHomeBodyName + " for wrap obstacle " + getName() + " was not found in model.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\t_wrapVcylHomeBody = &aModel.updBodySet().get(_wrapVcylHomeBodyName);\n+\t\n }\n \n //_____________________________________________________________________________\n@@ -219,21 +217,21 @@ void WrapDoubleCylinderObst::connectToModelAndBody(Model& aModel, OpenSim::Body&\n */\n void WrapDoubleCylinderObst::copyData(const WrapDoubleCylinderObst& aWrapDoubleCylinderObst)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapDoubleCylinderObst);\n-\n-    _radiusUcyl = aWrapDoubleCylinderObst._radiusUcyl;\n-    _radiusVcyl = aWrapDoubleCylinderObst._radiusVcyl;\n-    _wrapUcylDirectionName = aWrapDoubleCylinderObst._wrapUcylDirectionName;\n-    _wrapVcylDirectionName = aWrapDoubleCylinderObst._wrapVcylDirectionName;\n-    _wrapUcylDirection = aWrapDoubleCylinderObst._wrapUcylDirection;\n-    _wrapVcylDirection = aWrapDoubleCylinderObst._wrapVcylDirection;\n-    _wrapVcylHomeBodyName = aWrapDoubleCylinderObst._wrapVcylHomeBodyName;\n-    _wrapVcylHomeBody = aWrapDoubleCylinderObst._wrapVcylHomeBody;\n-    _xyzBodyRotationVcyl = aWrapDoubleCylinderObst._xyzBodyRotationVcyl;\n-    _translationVcyl = aWrapDoubleCylinderObst._translationVcyl;\n-    _length = aWrapDoubleCylinderObst._length;\n-    _activeState = aWrapDoubleCylinderObst._activeState;\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapDoubleCylinderObst);\n+\n+\t_radiusUcyl = aWrapDoubleCylinderObst._radiusUcyl;\n+\t_radiusVcyl = aWrapDoubleCylinderObst._radiusVcyl;\n+\t_wrapUcylDirectionName = aWrapDoubleCylinderObst._wrapUcylDirectionName;\n+\t_wrapVcylDirectionName = aWrapDoubleCylinderObst._wrapVcylDirectionName;\n+\t_wrapUcylDirection = aWrapDoubleCylinderObst._wrapUcylDirection;\n+\t_wrapVcylDirection = aWrapDoubleCylinderObst._wrapVcylDirection;\n+\t_wrapVcylHomeBodyName = aWrapDoubleCylinderObst._wrapVcylHomeBodyName;\n+\t_wrapVcylHomeBody = aWrapDoubleCylinderObst._wrapVcylHomeBody;\n+\t_xyzBodyRotationVcyl = aWrapDoubleCylinderObst._xyzBodyRotationVcyl;\n+\t_translationVcyl = aWrapDoubleCylinderObst._translationVcyl;\n+\t_length = aWrapDoubleCylinderObst._length;\n+\t_activeState = aWrapDoubleCylinderObst._activeState;\n }\n \n //_____________________________________________________________________________\n@@ -244,7 +242,7 @@ void WrapDoubleCylinderObst::copyData(const WrapDoubleCylinderObst& aWrapDoubleC\n  */\n const char* WrapDoubleCylinderObst::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -257,10 +255,10 @@ const char* WrapDoubleCylinderObst::getWrapTypeName() const\n  */\n string WrapDoubleCylinderObst::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _radiusUcyl << "\\nheight " << _length;\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _radiusUcyl << "\\nheight " << _length;\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n \n //=============================================================================\n@@ -274,10 +272,10 @@ string WrapDoubleCylinderObst::getDimensionsString() const\n */\n WrapDoubleCylinderObst& WrapDoubleCylinderObst::operator=(const WrapDoubleCylinderObst& aWrapDoubleCylinderObst)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapDoubleCylinderObst);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapDoubleCylinderObst);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n \n@@ -286,172 +284,172 @@ WrapDoubleCylinderObst& WrapDoubleCylinderObst::operator=(const WrapDoubleCylind\n \n \n /*============================================================================*/\n-#define OBST_BUFF   0.0001  /* BUFFER BETWEEN OBST SURFACE AND POINTS (IN mm) */\n+#define OBST_BUFF\t0.0001\t/* BUFFER BETWEEN OBST SURFACE AND POINTS (IN mm) */\n #define ABS(A) ( (A)>0 ? (A) : (-(A)) )\n #define SIGN(A) ( (A)>=0 ? (1) : (-1) )\n #define ZERO(A) ( ABS(A)<1.0e-8 ? (1) : (0) )\n-#define DISTANCE_BETWEEN(P,S)                       \\\n-    (                                               \\\n-        sqrt(   (P[0]-S[0])*(P[0]-S[0]) +           \\\n-                (P[1]-S[1])*(P[1]-S[1]) +           \\\n-                (P[2]-S[2])*(P[2]-S[2])   )         \\\n-    )\n+#define DISTANCE_BETWEEN(P,S)\t\t\t\t\t\t\\\n+\t(\t\t\t\t\t\t\t\t\t\t\t\t\\\n+\t\tsqrt(\t(P[0]-S[0])*(P[0]-S[0]) +\t\t\t\\\n+\t\t\t\t(P[1]-S[1])*(P[1]-S[1]) +\t\t\t\\\n+\t\t\t\t(P[2]-S[2])*(P[2]-S[2])   )\t\t\t\\\n+\t)\n /*===========================================================================*/\n static int quick_add_vec_to_vec(double *A,double *B,double *C) {\n-    C[0] = A[0] + B[0];\n-    C[1] = A[1] + B[1];\n-    C[2] = A[2] + B[2];\n-    return(0);\n+\tC[0] = A[0] + B[0];\n+\tC[1] = A[1] + B[1];\n+\tC[2] = A[2] + B[2];\n+\treturn(0);\n }\n /*===========================================================================*/\n static int quick_sub_vec_fm_vec(double *A,double *B,double *C) {\n-    C[0] = A[0] - B[0];\n-    C[1] = A[1] - B[1];\n-    C[2] = A[2] - B[2];\n-    return(0);\n+\tC[0] = A[0] - B[0];\n+\tC[1] = A[1] - B[1];\n+\tC[2] = A[2] - B[2];\n+\treturn(0);\n }\n /*===========================================================================*/\n static int quick_mul_vec_by_mtx(double *V,double *R,double *C) {\n-    double x,y,z;\n-    x = R[0]*V[0] + R[1]*V[1] + R[2]*V[2];\n-    y = R[3]*V[0] + R[4]*V[1] + R[5]*V[2];\n-    z = R[6]*V[0] + R[7]*V[1] + R[8]*V[2];\n-    C[0]=x; C[1]=y; C[2]=z;\n-    return(0);\n+\tdouble x,y,z;\n+\tx = R[0]*V[0] + R[1]*V[1] + R[2]*V[2];\n+\ty = R[3]*V[0] + R[4]*V[1] + R[5]*V[2];\n+\tz = R[6]*V[0] + R[7]*V[1] + R[8]*V[2];\n+\tC[0]=x;\tC[1]=y;\tC[2]=z;\n+\treturn(0);\n }\n /*===========================================================================*/\n static int quick_mul_vec_by_mtxT(double *V,double *R,double *C) {\n-    double x,y,z;\n-    x = R[0]*V[0] + R[3]*V[1] + R[6]*V[2];\n-    y = R[1]*V[0] + R[4]*V[1] + R[7]*V[2];\n-    z = R[2]*V[0] + R[5]*V[1] + R[8]*V[2];\n-    C[0]=x; C[1]=y; C[2]=z;\n-    return(0);\n+\tdouble x,y,z;\n+\tx = R[0]*V[0] + R[3]*V[1] + R[6]*V[2];\n+\ty = R[1]*V[0] + R[4]*V[1] + R[7]*V[2];\n+\tz = R[2]*V[0] + R[5]*V[1] + R[8]*V[2];\n+\tC[0]=x;\tC[1]=y;\tC[2]=z;\n+\treturn(0);\n }\n /*===========================================================================*/\n static int quick_mul_mtx_by_mtx(double *A,double *B,double *C) {\n-    C[0] = A[0]*B[0] + A[1]*B[3] + A[2]*B[6];\n-    C[1] = A[0]*B[1] + A[1]*B[4] + A[2]*B[7];\n-    C[2] = A[0]*B[2] + A[1]*B[5] + A[2]*B[8];\n-    C[3] = A[3]*B[0] + A[4]*B[3] + A[5]*B[6];\n-    C[4] = A[3]*B[1] + A[4]*B[4] + A[5]*B[7];\n-    C[5] = A[3]*B[2] + A[4]*B[5] + A[5]*B[8];\n-    C[6] = A[6]*B[0] + A[7]*B[3] + A[8]*B[6];\n-    C[7] = A[6]*B[1] + A[7]*B[4] + A[8]*B[7];\n-    C[8] = A[6]*B[2] + A[7]*B[5] + A[8]*B[8];\n-    return(0);\n+\tC[0] = A[0]*B[0] + A[1]*B[3] + A[2]*B[6];\n+\tC[1] = A[0]*B[1] + A[1]*B[4] + A[2]*B[7];\n+\tC[2] = A[0]*B[2] + A[1]*B[5] + A[2]*B[8];\n+\tC[3] = A[3]*B[0] + A[4]*B[3] + A[5]*B[6];\n+\tC[4] = A[3]*B[1] + A[4]*B[4] + A[5]*B[7];\n+\tC[5] = A[3]*B[2] + A[4]*B[5] + A[5]*B[8];\n+\tC[6] = A[6]*B[0] + A[7]*B[3] + A[8]*B[6];\n+\tC[7] = A[6]*B[1] + A[7]*B[4] + A[8]*B[7];\n+\tC[8] = A[6]*B[2] + A[7]*B[5] + A[8]*B[8];\n+\treturn(0);\n }\n /*===========================================================================*/\n static int quick_mul_mtx_by_mtxT(double *A,double *B,double *C) {\n-    C[0] = A[0]*B[0] + A[1]*B[1] + A[2]*B[2];\n-    C[1] = A[0]*B[3] + A[1]*B[4] + A[2]*B[5];\n-    C[2] = A[0]*B[6] + A[1]*B[7] + A[2]*B[8];\n-    C[3] = A[3]*B[0] + A[4]*B[1] + A[5]*B[2];\n-    C[4] = A[3]*B[3] + A[4]*B[4] + A[5]*B[5];\n-    C[5] = A[3]*B[6] + A[4]*B[7] + A[5]*B[8];\n-    C[6] = A[6]*B[0] + A[7]*B[1] + A[8]*B[2];\n-    C[7] = A[6]*B[3] + A[7]*B[4] + A[8]*B[5];\n-    C[8] = A[6]*B[6] + A[7]*B[7] + A[8]*B[8];\n-    return(0);\n+\tC[0] = A[0]*B[0] + A[1]*B[1] + A[2]*B[2];\n+\tC[1] = A[0]*B[3] + A[1]*B[4] + A[2]*B[5];\n+\tC[2] = A[0]*B[6] + A[1]*B[7] + A[2]*B[8];\n+\tC[3] = A[3]*B[0] + A[4]*B[1] + A[5]*B[2];\n+\tC[4] = A[3]*B[3] + A[4]*B[4] + A[5]*B[5];\n+\tC[5] = A[3]*B[6] + A[4]*B[7] + A[5]*B[8];\n+\tC[6] = A[6]*B[0] + A[7]*B[1] + A[8]*B[2];\n+\tC[7] = A[6]*B[3] + A[7]*B[4] + A[8]*B[5];\n+\tC[8] = A[6]*B[6] + A[7]*B[7] + A[8]*B[8];\n+\treturn(0);\n }\n /*===========================================================================*/\n static int quick_mul_mtxT_by_mtx(double *A,double *B,double *C) {\n-    C[0] = A[0]*B[0] + A[3]*B[3] + A[6]*B[6];\n-    C[1] = A[0]*B[1] + A[3]*B[4] + A[6]*B[7];\n-    C[2] = A[0]*B[2] + A[3]*B[5] + A[6]*B[8];\n-    C[3] = A[1]*B[0] + A[4]*B[3] + A[7]*B[6];\n-    C[4] = A[1]*B[1] + A[4]*B[4] + A[7]*B[7];\n-    C[5] = A[1]*B[2] + A[4]*B[5] + A[7]*B[8];\n-    C[6] = A[2]*B[0] + A[5]*B[3] + A[8]*B[6];\n-    C[7] = A[2]*B[1] + A[5]*B[4] + A[8]*B[7];\n-    C[8] = A[2]*B[2] + A[5]*B[5] + A[8]*B[8];\n-    return(0);\n+\tC[0] = A[0]*B[0] + A[3]*B[3] + A[6]*B[6];\n+\tC[1] = A[0]*B[1] + A[3]*B[4] + A[6]*B[7];\n+\tC[2] = A[0]*B[2] + A[3]*B[5] + A[6]*B[8];\n+\tC[3] = A[1]*B[0] + A[4]*B[3] + A[7]*B[6];\n+\tC[4] = A[1]*B[1] + A[4]*B[4] + A[7]*B[7];\n+\tC[5] = A[1]*B[2] + A[4]*B[5] + A[7]*B[8];\n+\tC[6] = A[2]*B[0] + A[5]*B[3] + A[8]*B[6];\n+\tC[7] = A[2]*B[1] + A[5]*B[4] + A[8]*B[7];\n+\tC[8] = A[2]*B[2] + A[5]*B[5] + A[8]*B[8];\n+\treturn(0);\n }\n /*===========================================================================*/\n static int load_Rx(double q,double R[9]) {\n-    double cn,sn;\n-    cn = cos(q);    sn = sin(q);\n-    R[0] = 1.0;     R[1] = 0.0;     R[2] = 0.0;\n-    R[3] = 0.0;     R[4] =  cn;     R[5] = -sn;\n-    R[6] = 0.0;     R[7] =  sn;     R[8] =  cn;\n-    return(0);\n+\tdouble cn,sn;\n+\tcn = cos(q);\tsn = sin(q);\n+\tR[0] = 1.0;\t\tR[1] = 0.0;\t\tR[2] = 0.0;\n+\tR[3] = 0.0;\t\tR[4] =  cn;\t\tR[5] = -sn;\n+\tR[6] = 0.0;\t\tR[7] =  sn;\t\tR[8] =  cn;\n+\treturn(0);\n }\n /*===========================================================================*/\n static int load_Ry(double q,double R[9]) {\n-    double cn,sn;\n-    cn = cos(q);    sn = sin(q);\n-    R[0] =  cn;     R[1] = 0.0;     R[2] =  sn;\n-    R[3] = 0.0;     R[4] = 1.0;     R[5] = 0.0;\n-    R[6] = -sn;     R[7] = 0.0;     R[8] =  cn;\n-    return(0);\n+\tdouble cn,sn;\n+\tcn = cos(q);\tsn = sin(q);\n+\tR[0] =  cn;\t\tR[1] = 0.0;\t\tR[2] =  sn;\n+\tR[3] = 0.0;\t\tR[4] = 1.0;\t\tR[5] = 0.0;\n+\tR[6] = -sn;\t\tR[7] = 0.0;\t\tR[8] =  cn;\n+\treturn(0);\n }\n /*===========================================================================*/\n static int load_Rz(double q,double R[9]) {\n-    double cn,sn;\n-    cn = cos(q);    sn = sin(q);\n-    R[0] =  cn;     R[1] = -sn;     R[2] = 0.0;\n-    R[3] =  sn;     R[4] =  cn;     R[5] = 0.0;\n-    R[6] = 0.0;     R[7] = 0.0;     R[8] = 1.0;\n-    return(0);\n+\tdouble cn,sn;\n+\tcn = cos(q);\tsn = sin(q);\n+\tR[0] =  cn;\t\tR[1] = -sn;\t\tR[2] = 0.0;\n+\tR[3] =  sn;\t\tR[4] =  cn;\t\tR[5] = 0.0;\n+\tR[6] = 0.0;\t\tR[7] = 0.0;\t\tR[8] = 1.0;\n+\treturn(0);\n }\n /*===========================================================================*/\n static int load_Rxyz(double q[3],double Rxyz[9]) {\n-    double Rx[9],Ry[9],Rz[9],Rxy[9];\n-    load_Rx(q[0],Rx); load_Ry(q[1],Ry); load_Rz(q[2],Rz);\n-    quick_mul_mtx_by_mtx(Rx,Ry,Rxy);\n-    quick_mul_mtx_by_mtx(Rxy,Rz,Rxyz);\n-    return(0);\n+\tdouble Rx[9],Ry[9],Rz[9],Rxy[9];\n+\tload_Rx(q[0],Rx); load_Ry(q[1],Ry); load_Rz(q[2],Rz);\n+\tquick_mul_mtx_by_mtx(Rx,Ry,Rxy);\n+\tquick_mul_mtx_by_mtx(Rxy,Rz,Rxyz);\n+\treturn(0);\n }\n /*===========================================================================*/\n /*====== SOLVE THE SYSTEM OF LINEAR EQUATIONS:  A(NxN)*X(Nx1)=B(Nx1) ========*/\n /*===========================================================================*/\n static int quick_solve_linear(int N,double A[],double X[],double B[]) {\n-    static double *MTX=NULL,**Mtx=NULL;\n-    static int mtxsize=0;\n-    double **Mr,*Mrj,*Mij,*Xr,*Br,d;\n-    int r,i,j,n;\n-\n-    /*====================================================================*/\n-    /*======= ALLOCATE STORAGE FOR DUPLICATE OF A AND ROW POINTERS =======*/\n-    /*====================================================================*/\n-    if(mtxsize<N*(N+1)) {   mtxsize=N*(N+1);\n-        MTX=(double *)  malloc(mtxsize*sizeof(double));\n-        Mtx=(double **) malloc(N*sizeof(double *));\n-        if(Mtx==NULL) { fprintf(stderr,"\\nOut of memory.\\n\\n"); exit(0); }\n-    }\n-    /*====================================================================*/\n-\n-    /*====================================================================*/\n-    /*== COPY A INTO MTX(NxN), B INTO MTX(N+1), AND LOAD POINTER VECTOR ==*/\n-    /*====================================================================*/\n-    for(r=0,Mrj=MTX,Mij=A,Br=B;r<N;r++) {\n-        for(j=0;j<N;j++) *(Mrj++) = *(Mij++);   *(Mrj++) = *(Br++); }\n-    for(r=0,Mr=Mtx;r<N;r++) *(Mr++)=MTX+r*(N+1);\n-    /*====================================================================*/\n-\n-    /*====================================================================*/\n-    /*======= REDUCE MTX TO UPPER TRIANGULAR USING ROW OPS ON MTX ========*/\n-    /*====================================================================*/\n-    for(r=0,n=N-1;r<n;r++) {\n-        if(ZERO(*(Mrj=Mtx[r]+r))) { /*==== SWAP ROWS ====*/\n-            for(i=r+1;i<N;i++) if(!ZERO(*(Mtx[i]+r))) break;\n-            if(i==N) return(-1);    /*=== NON-INVERTIBLE ===*/\n-            Mrj=Mtx[r]; Mtx[r]=Mtx[i];  Mtx[i]=Mrj; Mrj=Mtx[r]+r;\n-        }\n-        for(i=r+1;i<N;i++) {\n-            if(ZERO(*(Mij=Mtx[i]+r))) continue; Mrj=Mtx[r]+r;\n-            d = (*Mij)/(*Mrj);  *(Mij++)=0.0;   Mrj++;\n-            for(j=r+1;j<=N;j++) *(Mij++) -= *(Mrj++)*d;\n-        }\n-    }\n-    /*====================================================================*/\n-\n-    if(ZERO(*(Mrj=Mtx[r]+r))) return(-1);   /*=== NON-INVERTIBLE ===*/\n-\n-    /*====================================================================*/\n-    /*========= BACK PROPAGATE SOLUTION THROUGH TRIANGULAR MATRIX ========*/\n-    /*====================================================================*/\n-    n=N-1;  Xr=X+n;\n+\tstatic double *MTX=NULL,**Mtx=NULL;\n+\tstatic int mtxsize=0;\n+\tdouble **Mr,*Mrj,*Mij,*Xr,*Br,d;\n+\tint r,i,j,n;\n+\n+\t/*====================================================================*/\n+\t/*======= ALLOCATE STORAGE FOR DUPLICATE OF A AND ROW POINTERS =======*/\n+\t/*====================================================================*/\n+\tif(mtxsize<N*(N+1)) {\tmtxsize=N*(N+1);\n+\t\tMTX=(double *)  malloc(mtxsize*sizeof(double));\n+\t\tMtx=(double **) malloc(N*sizeof(double *));\n+\t\tif(Mtx==NULL) { fprintf(stderr,"\\nOut of memory.\\n\\n"); exit(0); }\n+\t}\n+\t/*====================================================================*/\n+\n+\t/*====================================================================*/\n+\t/*== COPY A INTO MTX(NxN), B INTO MTX(N+1), AND LOAD POINTER VECTOR ==*/\n+\t/*====================================================================*/\n+\tfor(r=0,Mrj=MTX,Mij=A,Br=B;r<N;r++) {\n+\t\tfor(j=0;j<N;j++) *(Mrj++) = *(Mij++);\t*(Mrj++) = *(Br++); }\n+\tfor(r=0,Mr=Mtx;r<N;r++) *(Mr++)=MTX+r*(N+1);\n+\t/*====================================================================*/\n+\n+\t/*====================================================================*/\n+\t/*======= REDUCE MTX TO UPPER TRIANGULAR USING ROW OPS ON MTX ========*/\n+\t/*====================================================================*/\n+\tfor(r=0,n=N-1;r<n;r++) {\n+\t\tif(ZERO(*(Mrj=Mtx[r]+r))) {\t/*==== SWAP ROWS ====*/\n+\t\t\tfor(i=r+1;i<N;i++) if(!ZERO(*(Mtx[i]+r))) break;\n+\t\t\tif(i==N) return(-1);\t/*=== NON-INVERTIBLE ===*/\n+\t\t\tMrj=Mtx[r];\tMtx[r]=Mtx[i];\tMtx[i]=Mrj;\tMrj=Mtx[r]+r;\n+\t\t}\n+\t\tfor(i=r+1;i<N;i++) {\n+\t\t\tif(ZERO(*(Mij=Mtx[i]+r))) continue;\tMrj=Mtx[r]+r;\n+\t\t\td = (*Mij)/(*Mrj);\t*(Mij++)=0.0;\tMrj++;\n+\t\t\tfor(j=r+1;j<=N;j++) *(Mij++) -= *(Mrj++)*d;\n+\t\t}\n+\t}\n+\t/*====================================================================*/\n+\n+\tif(ZERO(*(Mrj=Mtx[r]+r))) return(-1);\t/*=== NON-INVERTIBLE ===*/\n+\n+\t/*====================================================================*/\n+\t/*========= BACK PROPAGATE SOLUTION THROUGH TRIANGULAR MATRIX ========*/\n+\t/*====================================================================*/\n+\tn=N-1;\tXr=X+n;\n     // The next two lines used to be combined in 1 line:\n     //      *Xr = *((Mrj=Mtx[n])+N) / *(Mrj+n);\n     // which gave a Wunsequenced warning using Clang, due to the assignment to\n@@ -460,14 +458,14 @@ static int quick_solve_linear(int N,double A[],double X[],double B[]) {\n     // entry of X is the last entry of B divided by the (N, N) element of A.\n     Mrj = Mtx[n];\n     *Xr = *(Mrj+N) / *(Mrj+n);\n-    for(r=n-1,Xr--,Mr=Mtx+r;r>=0;r--,Mr--) {\n-        d = *(*Mr+N);\n-        for(j=r+1,Mrj= *Mr+j;j<N;j++) d -= *(Mrj++)*X[j];\n-        *(Xr--) = d / *(*Mr+r);\n-    }\n-    /*====================================================================*/\n-\n-    return(0);\n+\tfor(r=n-1,Xr--,Mr=Mtx+r;r>=0;r--,Mr--) {\n+\t\td = *(*Mr+N);\n+\t\tfor(j=r+1,Mrj= *Mr+j;j<N;j++) d -= *(Mrj++)*X[j];\n+\t\t*(Xr--) = d / *(*Mr+r);\n+\t}\n+\t/*====================================================================*/\n+\n+\treturn(0);\n }\n /*============================================================================*/\n \n@@ -484,7 +482,7 @@ static int quick_solve_linear(int N,double A[],double X[],double B[]) {\n static int double_cylinder(double U[3],double Ru,double V[3],double Rv,double M[9],\n    double P[3],double q[3],double Q[3],double T[3],double t[3],double S[3],\n    double *Pq,double *qQ,double *QT,double *Tt,double *tS,double *L,\n-    int *active,double *ru,double *rv);\n+\tint *active,double *ru,double *rv);\n \n //_____________________________________________________________________________\n /**\n@@ -498,86 +496,86 @@ static int double_cylinder(double U[3],double Ru,double V[3],double Rv,double M[\n  * @return The status, as a WrapAction enum\n  */\n int WrapDoubleCylinderObst::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                        const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\tconst PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n \n-    double U[3];    U[0]=_translation[0];       U[1]=_translation[1];       U[2]=_translation[2];\n-    double V[3];    V[0]=_translationVcyl[0];   V[1]=_translationVcyl[1];   V[2]=_translationVcyl[2];\n-    double Ru = ( _wrapUcylDirection==righthand ? _radiusUcyl : -_radiusUcyl );\n-    double Rv = ( _wrapVcylDirection==righthand ? _radiusVcyl : -_radiusVcyl );\n-\n-    double P[3],q[3],Q[3],Pq,qQ,QT,ru;      P[0]=aPoint1[0];    P[1]=aPoint1[1];    P[2]=aPoint1[2];\n-    double S[3],t[3],T[3],Tt,tS,L,rv;       S[0]=aPoint2[0];    S[1]=aPoint2[1];    S[2]=aPoint2[2];\n-    \n-    // CONSTRUCT SOME ROTATION MATRICES\n-    double VcylObstToUcylObst[9];   // DEFINE M As Rotation Matrix from V-Cylinder to U-Cyllinder Frame\n-    double xyzBodyRotation[3] = { _xyzBodyRotation[0], _xyzBodyRotation[1], _xyzBodyRotation[2] };\n-    double xyzBodyRotationVcyl[3] = { _xyzBodyRotationVcyl[0],_xyzBodyRotationVcyl[1],_xyzBodyRotationVcyl[2] };\n-    double UcylObstToUcylBody[9];   load_Rxyz(xyzBodyRotation,UcylObstToUcylBody);\n-    double VcylObstToVcylBody[9];   load_Rxyz(xyzBodyRotationVcyl,VcylObstToVcylBody);\n-    double UcylBodyToGround[9];     _model->getSimbodyEngine().getDirectionCosines(s, *_wrapUcylHomeBody,UcylBodyToGround);\n-    double VcylBodyToGround[9];     _model->getSimbodyEngine().getDirectionCosines(s, *_wrapVcylHomeBody,VcylBodyToGround);\n-    double VcylBodyToUcylBody[9];   quick_mul_mtxT_by_mtx(UcylBodyToGround,VcylBodyToGround,VcylBodyToUcylBody);\n-    double VcylObstToUcylBody[9];   quick_mul_mtx_by_mtx(VcylBodyToUcylBody,VcylObstToVcylBody,VcylObstToUcylBody);\n-    quick_mul_mtxT_by_mtx(UcylObstToUcylBody,VcylObstToUcylBody,VcylObstToUcylObst);\n-\n-    double u[3];    // Position of Ucyl center in Vcyl frame;   NOTE:  U is Posn of Ucyl center in Ucyl body frame\n-    _model->getSimbodyEngine().transformPosition(s, *_wrapUcylHomeBody, U, *_wrapVcylHomeBody, u);\n-    quick_sub_vec_fm_vec( u, V, u );                    // Translate u from Vcyl body to Vcyl obstacle\n-    quick_mul_vec_by_mtxT( u, VcylObstToVcylBody, u );  // Rotate u into Vcyl obstacle frame\n-\n-    double v[3];    // Position of Vcyl center in Ucyl frame;   NOTE:  V is Posn of Vcyl center in Vcyl body frame\n-    _model->getSimbodyEngine().transformPosition(s, *_wrapVcylHomeBody, V, *_wrapUcylHomeBody, v);\n-    quick_sub_vec_fm_vec( v, U, v );                    // Translate v from Ucyl body to Ucyl obstacle\n-    quick_mul_vec_by_mtxT( v, UcylObstToUcylBody, v );  // Rotate v into Ucyl obstacle frame\n-\n-    double vs[3],ss[3]; // Position of S in Vcyl obstacle frame;    NOTE:  S is Posn of S in Ucyl obstacle frame\n-    quick_mul_vec_by_mtx( S, UcylObstToUcylBody, vs );  // Rotate S into Ucyl body frame\n-    quick_add_vec_to_vec( vs, U, vs );                  // Translate s into Ucyl body frame\n-    _model->getSimbodyEngine().transformPosition(s, *_wrapUcylHomeBody, vs, *_wrapVcylHomeBody, ss);\n-    quick_sub_vec_fm_vec( ss, V, vs );                  // Translate s from Vcyl body to Vcyl obstacle\n-    quick_mul_vec_by_mtxT( vs, VcylObstToVcylBody, vs );    // Rotate s into Vcyl obstacle frame\n-\n-    int activeState=(int)aWrapResult.c1[0]; // _activeState;    // TEMP set to zero\n-    if( (int)aWrapResult.c1[1] != 12345 ) { aWrapResult.c1[1]=12345.01; activeState=0; }    // Initialize activeState first iteration\n-    double_cylinder(u,Ru,v,Rv,  VcylObstToUcylObst,  P,q,Q,T,t,vs, &Pq,&qQ,&QT,&Tt,&tS,&L, &activeState, &ru,&rv);\n-//  _activeState=activeState;       ???? I CAN\'T SEEM TO SET THIS!!!  GARNER - Needs to be Set in a WrapResult variable.\n-    aWrapResult.c1[0]=activeState+0.01; // Save active state for reference in next iteration\n-\n-    // Transform T back into Ucylinder frame\n-    quick_mul_vec_by_mtx( T, VcylObstToVcylBody, T );\n-    quick_add_vec_to_vec( T, V, T );\n-    _model->getSimbodyEngine().transformPosition(s, *_wrapVcylHomeBody, T, *_wrapUcylHomeBody, T);\n-    quick_sub_vec_fm_vec( T, U, T );                    // Translate T from Ucyl body to Ucyl obstacle\n-    quick_mul_vec_by_mtxT( T, UcylObstToUcylBody, T );  // Rotate T into Ucyl obstacle frame\n-\n-    // Transform t back into Ucylinder frame\n-    quick_mul_vec_by_mtx( t, VcylObstToVcylBody, t );\n-    quick_add_vec_to_vec( t, V, t );\n-    _model->getSimbodyEngine().transformPosition(s, *_wrapVcylHomeBody, t, *_wrapUcylHomeBody, t);\n-    quick_sub_vec_fm_vec( t, U, t );                    // Translate t from Ucyl body to Ucyl obstacle\n-    quick_mul_vec_by_mtxT( t, UcylObstToUcylBody, t );  // Rotate t into Ucyl obstacle frame\n-\n-    // Initialize return values\n-    aFlag = false;\n-    aWrapResult.wrap_path_length = 0.0;\n-    aWrapResult.wrap_pts.setSize(0);\n-\n-    // Register results and return\n-    aFlag = true;\n-    aWrapResult.wrap_path_length = qQ + QT + Tt;    // PQ + TS + QT;\n-    aWrapResult.r1[0]=q[0];  aWrapResult.r1[1]=q[1];  aWrapResult.r1[2]=q[2];  \n-    aWrapResult.r2[0]=t[0];  aWrapResult.r2[1]=t[1];  aWrapResult.r2[2]=t[2];\n-//  aWrapResult.c1[0]=Q[0];  aWrapResult.c1[1]=Q[1];  aWrapResult.c1[2]=Q[2];  \n-//  aWrapResult.sv[0]=T[0];  aWrapResult.sv[1]=T[1];  aWrapResult.sv[2]=T[2];\n-    \n-    // Generate wrap_pts sequence of points tracing out wrapping path\n-    aWrapResult.wrap_pts.append(aWrapResult.r1);\n-//  SimmPoint wppt2(aWrapResult.c1);    aWrapResult.wrap_pts.append(wppt2);\n-//  SimmPoint wppt3(aWrapResult.sv);    aWrapResult.wrap_pts.append(wppt3);\n-    aWrapResult.wrap_pts.append(aWrapResult.r2);\n-\n-    return wrapped;\n+\tdouble U[3];\tU[0]=_translation[0];\t\tU[1]=_translation[1];\t\tU[2]=_translation[2];\n+\tdouble V[3];\tV[0]=_translationVcyl[0];\tV[1]=_translationVcyl[1];\tV[2]=_translationVcyl[2];\n+\tdouble Ru = ( _wrapUcylDirection==righthand ? _radiusUcyl : -_radiusUcyl );\n+\tdouble Rv = ( _wrapVcylDirection==righthand ? _radiusVcyl : -_radiusVcyl );\n+\n+\tdouble P[3],q[3],Q[3],Pq,qQ,QT,ru;\t\tP[0]=aPoint1[0];\tP[1]=aPoint1[1];\tP[2]=aPoint1[2];\n+\tdouble S[3],t[3],T[3],Tt,tS,L,rv;\t\tS[0]=aPoint2[0];\tS[1]=aPoint2[1];\tS[2]=aPoint2[2];\n+\t\n+\t// CONSTRUCT SOME ROTATION MATRICES\n+\tdouble VcylObstToUcylObst[9];\t// DEFINE M As Rotation Matrix from V-Cylinder to U-Cyllinder Frame\n+\tdouble xyzBodyRotation[3] = { _xyzBodyRotation[0], _xyzBodyRotation[1], _xyzBodyRotation[2] };\n+\tdouble xyzBodyRotationVcyl[3] = { _xyzBodyRotationVcyl[0],_xyzBodyRotationVcyl[1],_xyzBodyRotationVcyl[2] };\n+\tdouble UcylObstToUcylBody[9];\tload_Rxyz(xyzBodyRotation,UcylObstToUcylBody);\n+\tdouble VcylObstToVcylBody[9];\tload_Rxyz(xyzBodyRotationVcyl,VcylObstToVcylBody);\n+\tdouble UcylBodyToGround[9];\t\t_model->getSimbodyEngine().getDirectionCosines(s, *_wrapUcylHomeBody,UcylBodyToGround);\n+\tdouble VcylBodyToGround[9];\t\t_model->getSimbodyEngine().getDirectionCosines(s, *_wrapVcylHomeBody,VcylBodyToGround);\n+\tdouble VcylBodyToUcylBody[9];\tquick_mul_mtxT_by_mtx(UcylBodyToGround,VcylBodyToGround,VcylBodyToUcylBody);\n+\tdouble VcylObstToUcylBody[9];\tquick_mul_mtx_by_mtx(VcylBodyToUcylBody,VcylObstToVcylBody,VcylObstToUcylBody);\n+\tquick_mul_mtxT_by_mtx(UcylObstToUcylBody,VcylObstToUcylBody,VcylObstToUcylObst);\n+\n+\tdouble u[3];\t// Position of Ucyl center in Vcyl frame;   NOTE:  U is Posn of Ucyl center in Ucyl body frame\n+\t_model->getSimbodyEngine().transformPosition(s, *_wrapUcylHomeBody, U, *_wrapVcylHomeBody, u);\n+\tquick_sub_vec_fm_vec( u, V, u );\t\t\t\t\t// Translate u from Vcyl body to Vcyl obstacle\n+\tquick_mul_vec_by_mtxT( u, VcylObstToVcylBody, u );\t// Rotate u into Vcyl obstacle frame\n+\n+\tdouble v[3];\t// Position of Vcyl center in Ucyl frame;   NOTE:  V is Posn of Vcyl center in Vcyl body frame\n+\t_model->getSimbodyEngine().transformPosition(s, *_wrapVcylHomeBody, V, *_wrapUcylHomeBody, v);\n+\tquick_sub_vec_fm_vec( v, U, v );\t\t\t\t\t// Translate v from Ucyl body to Ucyl obstacle\n+\tquick_mul_vec_by_mtxT( v, UcylObstToUcylBody, v );\t// Rotate v into Ucyl obstacle frame\n+\n+\tdouble vs[3],ss[3];\t// Position of S in Vcyl obstacle frame;\tNOTE:  S is Posn of S in Ucyl obstacle frame\n+\tquick_mul_vec_by_mtx( S, UcylObstToUcylBody, vs );\t// Rotate S into Ucyl body frame\n+\tquick_add_vec_to_vec( vs, U, vs );\t\t\t\t\t// Translate s into Ucyl body frame\n+\t_model->getSimbodyEngine().transformPosition(s, *_wrapUcylHomeBody, vs, *_wrapVcylHomeBody, ss);\n+\tquick_sub_vec_fm_vec( ss, V, vs );\t\t\t\t\t// Translate s from Vcyl body to Vcyl obstacle\n+\tquick_mul_vec_by_mtxT( vs, VcylObstToVcylBody, vs );\t// Rotate s into Vcyl obstacle frame\n+\n+\tint activeState=(int)aWrapResult.c1[0];\t// _activeState;\t// TEMP set to zero\n+\tif( (int)aWrapResult.c1[1] != 12345 ) {\taWrapResult.c1[1]=12345.01; activeState=0; }\t// Initialize activeState first iteration\n+\tdouble_cylinder(u,Ru,v,Rv,  VcylObstToUcylObst,  P,q,Q,T,t,vs, &Pq,&qQ,&QT,&Tt,&tS,&L, &activeState, &ru,&rv);\n+//\t_activeState=activeState;\t\t???? I CAN\'T SEEM TO SET THIS!!!  GARNER - Needs to be Set in a WrapResult variable.\n+\taWrapResult.c1[0]=activeState+0.01;\t// Save active state for reference in next iteration\n+\n+\t// Transform T back into Ucylinder frame\n+\tquick_mul_vec_by_mtx( T, VcylObstToVcylBody, T );\n+\tquick_add_vec_to_vec( T, V, T );\n+\t_model->getSimbodyEngine().transformPosition(s, *_wrapVcylHomeBody, T, *_wrapUcylHomeBody, T);\n+\tquick_sub_vec_fm_vec( T, U, T );\t\t\t\t\t// Translate T from Ucyl body to Ucyl obstacle\n+\tquick_mul_vec_by_mtxT( T, UcylObstToUcylBody, T );\t// Rotate T into Ucyl obstacle frame\n+\n+\t// Transform t back into Ucylinder frame\n+\tquick_mul_vec_by_mtx( t, VcylObstToVcylBody, t );\n+\tquick_add_vec_to_vec( t, V, t );\n+\t_model->getSimbodyEngine().transformPosition(s, *_wrapVcylHomeBody, t, *_wrapUcylHomeBody, t);\n+\tquick_sub_vec_fm_vec( t, U, t );\t\t\t\t\t// Translate t from Ucyl body to Ucyl obstacle\n+\tquick_mul_vec_by_mtxT( t, UcylObstToUcylBody, t );\t// Rotate t into Ucyl obstacle frame\n+\n+\t// Initialize return values\n+\taFlag = false;\n+\taWrapResult.wrap_path_length = 0.0;\n+\taWrapResult.wrap_pts.setSize(0);\n+\n+\t// Register results and return\n+\taFlag = true;\n+\taWrapResult.wrap_path_length = qQ + QT + Tt;\t// PQ + TS + QT;\n+\taWrapResult.r1[0]=q[0];  aWrapResult.r1[1]=q[1];  aWrapResult.r1[2]=q[2];  \n+\taWrapResult.r2[0]=t[0];  aWrapResult.r2[1]=t[1];  aWrapResult.r2[2]=t[2];\n+//\taWrapResult.c1[0]=Q[0];  aWrapResult.c1[1]=Q[1];  aWrapResult.c1[2]=Q[2];  \n+//\taWrapResult.sv[0]=T[0];  aWrapResult.sv[1]=T[1];  aWrapResult.sv[2]=T[2];\n+\t\n+\t// Generate wrap_pts sequence of points tracing out wrapping path\n+\taWrapResult.wrap_pts.append(aWrapResult.r1);\n+//\tSimmPoint wppt2(aWrapResult.c1);\taWrapResult.wrap_pts.append(wppt2);\n+//\tSimmPoint wppt3(aWrapResult.sv);\taWrapResult.wrap_pts.append(wppt3);\n+\taWrapResult.wrap_pts.append(aWrapResult.r2);\n+\n+\treturn wrapped;\n }\n \n \n@@ -587,27 +585,27 @@ int WrapDoubleCylinderObst::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1\n /*============================================================================*/\n void WrapDoubleCylinderObst::\n getVcylToUcylRotationMatrix(const SimTK::State& s, double VcylObstToUcylObst[9]) const {\n-    double xyzBodyRotation[3] = { _xyzBodyRotation[0], _xyzBodyRotation[1], _xyzBodyRotation[2] };\n-    double xyzBodyRotationVcyl[3] = { _xyzBodyRotationVcyl[0],_xyzBodyRotationVcyl[1],_xyzBodyRotationVcyl[2] };\n-    double UcylBodyToUcylObst[9];   load_Rxyz(xyzBodyRotation,UcylBodyToUcylObst);\n-    double VcylBodyToVcylObst[9];   load_Rxyz(xyzBodyRotationVcyl,VcylBodyToVcylObst);\n-    double UcylBodyToGround[9];     _model->getSimbodyEngine().getDirectionCosines(s, *_wrapUcylHomeBody,UcylBodyToGround);\n-    double VcylBodyToGround[9];     _model->getSimbodyEngine().getDirectionCosines(s, *_wrapVcylHomeBody,VcylBodyToGround);\n-    double VcylBodyToUcylBody[9];   quick_mul_mtxT_by_mtx(UcylBodyToGround,VcylBodyToGround,VcylBodyToUcylBody);\n-    double VcylObstToUcylBody[9];   quick_mul_mtx_by_mtxT(VcylBodyToUcylBody,VcylBodyToVcylObst,VcylObstToUcylBody);\n-    quick_mul_mtx_by_mtx(UcylBodyToUcylObst,VcylObstToUcylBody,VcylObstToUcylObst);\n+\tdouble xyzBodyRotation[3] = { _xyzBodyRotation[0], _xyzBodyRotation[1], _xyzBodyRotation[2] };\n+\tdouble xyzBodyRotationVcyl[3] = { _xyzBodyRotationVcyl[0],_xyzBodyRotationVcyl[1],_xyzBodyRotationVcyl[2] };\n+\tdouble UcylBodyToUcylObst[9];\tload_Rxyz(xyzBodyRotation,UcylBodyToUcylObst);\n+\tdouble VcylBodyToVcylObst[9];\tload_Rxyz(xyzBodyRotationVcyl,VcylBodyToVcylObst);\n+\tdouble UcylBodyToGround[9];\t\t_model->getSimbodyEngine().getDirectionCosines(s, *_wrapUcylHomeBody,UcylBodyToGround);\n+\tdouble VcylBodyToGround[9];\t\t_model->getSimbodyEngine().getDirectionCosines(s, *_wrapVcylHomeBody,VcylBodyToGround);\n+\tdouble VcylBodyToUcylBody[9];\tquick_mul_mtxT_by_mtx(UcylBodyToGround,VcylBodyToGround,VcylBodyToUcylBody);\n+\tdouble VcylObstToUcylBody[9];\tquick_mul_mtx_by_mtxT(VcylBodyToUcylBody,VcylBodyToVcylObst,VcylObstToUcylBody);\n+\tquick_mul_mtx_by_mtx(UcylBodyToUcylObst,VcylObstToUcylBody,VcylObstToUcylObst);\n }\n /*============================================================================*/\n \n-    \n+\t\n \n /*============================================================================*/\n /*==== DETERMINE WHETHER 2D PATH FROM P TO S WOULD COME WITHIN R OF ORIGIN ===*/\n /*============================================================================*/\n static int path_inside_radius(double P[2],double S[2],double R) {\n-    double a,b,c;\n-    a=S[1]-P[1];    b=P[0]-S[0];    c=a*P[0]+b*P[1];\n-    return( (c*c/(a*a+b*b)) <= R*R );\n+\tdouble a,b,c;\n+\ta=S[1]-P[1];\tb=P[0]-S[0];\tc=a*P[0]+b*P[1];\n+\treturn( (c*c/(a*a+b*b)) <= R*R );\n }\n /*============================================================================*/\n \n@@ -624,40 +622,40 @@ static int path_inside_radius(double P[2],double S[2],double R) {\n /*============================================================================*/\n static int single_cylinder(double R,double P[3],double q[3],double t[3],double S[3],\n    double *Pq,double *qt,double *tS,double *L,int *active,double *ru) {\n-    double dp,ds,rtp,rts,sgn,Rpos,buff;     *ru=R;\n-    sgn=SIGN(R);    Rpos=ABS(R);    buff=(Rpos+OBST_BUFF)*(Rpos+OBST_BUFF);\n-    /*==================================================================*/\n-    dp=P[0]*P[0]+P[1]*P[1]; rtp=dp-R*R; ds=S[0]*S[0]+S[1]*S[1]; rts=ds-R*R;\n-    if((dp<OBST_BUFF)||(ds<OBST_BUFF)) return(0);   /* NO ROOM TO SHRINK */\n-    if((dp<buff)||(ds<buff)) {  /* ONE POINT IS INSIDE CYLINDER SO SHRINK IT */\n-        if(dp<ds)   { R=sgn*(sqrt(dp)-OBST_BUFF);   rtp=dp-R*R; rts=ds-R*R; }\n-        else        { R=sgn*(sqrt(ds)-OBST_BUFF);   rtp=dp-R*R; rts=ds-R*R; }\n-    }   *ru=R;\n-    /*==================================================================*/\n-    dp=R/dp; rtp=sqrt(rtp); q[0]=(R*P[0]-rtp*P[1])*dp;  q[1]=(R*P[1]+rtp*P[0])*dp;\n-    ds=R/ds; rts=sqrt(rts); t[0]=(R*S[0]+rts*S[1])*ds;  t[1]=(R*S[1]-rts*S[0])*ds;\n-    /*==================================================================*/\n-    if(R*(q[0]*t[1]-q[1]*t[0])<0.0) {   /* CURL>180 DEGREE - ASSUME INACTIVE */\n-        q[0]=P[0];  q[1]=P[1];  q[2]=P[2];  *Pq=0.0;\n-        t[0]=S[0];  t[1]=S[1];  t[2]=S[2];  *tS=0.0;\n-        *L=*qt=DISTANCE_BETWEEN(q,t);   *active=0;  /* INACTIVE */\n-        return(0);\n-    }\n-    /*==================================================================*/\n-    *Pq=sqrt((q[0]-P[0])*(q[0]-P[0])+(q[1]-P[1])*(q[1]-P[1]));\n-    *tS=sqrt((t[0]-S[0])*(t[0]-S[0])+(t[1]-S[1])*(t[1]-S[1]));\n-    *qt=R*acos(1.0-0.5*((q[0]-t[0])*(q[0]-t[0])+(q[1]-t[1])*(q[1]-t[1]))/(R*R));\n-    *qt=ABS(*qt);\n-    /*==================================================================*/\n-    q[2]=P[2]+(S[2]-P[2])*(*Pq)/(*Pq+*tS+*qt);\n-    t[2]=S[2]+(P[2]-S[2])*(*tS)/(*Pq+*tS+*qt);\n-    /*==================================================================*/\n-    *Pq=sqrt((*Pq)*(*Pq)+(q[2]-P[2])*(q[2]-P[2]));\n-    *tS=sqrt((*tS)*(*tS)+(t[2]-S[2])*(t[2]-S[2]));\n-    *qt=sqrt((*qt)*(*qt)+(q[2]-t[2])*(q[2]-t[2]));  *L = *Pq + *qt + *tS;\n-    /*==================================================================*/\n-    *active=1;  /* ACTIVE */\n-    return(0);\n+\tdouble dp,ds,rtp,rts,sgn,Rpos,buff;\t\t*ru=R;\n+\tsgn=SIGN(R);\tRpos=ABS(R);\tbuff=(Rpos+OBST_BUFF)*(Rpos+OBST_BUFF);\n+\t/*==================================================================*/\n+\tdp=P[0]*P[0]+P[1]*P[1];\trtp=dp-R*R;\tds=S[0]*S[0]+S[1]*S[1];\trts=ds-R*R;\n+\tif((dp<OBST_BUFF)||(ds<OBST_BUFF)) return(0);\t/* NO ROOM TO SHRINK */\n+\tif((dp<buff)||(ds<buff)) {\t/* ONE POINT IS INSIDE CYLINDER SO SHRINK IT */\n+\t\tif(dp<ds)\t{ R=sgn*(sqrt(dp)-OBST_BUFF);\trtp=dp-R*R; rts=ds-R*R; }\n+\t\telse        { R=sgn*(sqrt(ds)-OBST_BUFF);\trtp=dp-R*R; rts=ds-R*R; }\n+\t}\t*ru=R;\n+\t/*==================================================================*/\n+\tdp=R/dp; rtp=sqrt(rtp);\tq[0]=(R*P[0]-rtp*P[1])*dp;\tq[1]=(R*P[1]+rtp*P[0])*dp;\n+\tds=R/ds; rts=sqrt(rts);\tt[0]=(R*S[0]+rts*S[1])*ds;\tt[1]=(R*S[1]-rts*S[0])*ds;\n+\t/*==================================================================*/\n+\tif(R*(q[0]*t[1]-q[1]*t[0])<0.0) {\t/* CURL>180 DEGREE - ASSUME INACTIVE */\n+\t\tq[0]=P[0];\tq[1]=P[1];\tq[2]=P[2];\t*Pq=0.0;\n+\t\tt[0]=S[0];\tt[1]=S[1];\tt[2]=S[2];\t*tS=0.0;\n+\t\t*L=*qt=DISTANCE_BETWEEN(q,t);\t*active=0;\t/* INACTIVE */\n+\t\treturn(0);\n+\t}\n+\t/*==================================================================*/\n+\t*Pq=sqrt((q[0]-P[0])*(q[0]-P[0])+(q[1]-P[1])*(q[1]-P[1]));\n+\t*tS=sqrt((t[0]-S[0])*(t[0]-S[0])+(t[1]-S[1])*(t[1]-S[1]));\n+\t*qt=R*acos(1.0-0.5*((q[0]-t[0])*(q[0]-t[0])+(q[1]-t[1])*(q[1]-t[1]))/(R*R));\n+\t*qt=ABS(*qt);\n+\t/*==================================================================*/\n+\tq[2]=P[2]+(S[2]-P[2])*(*Pq)/(*Pq+*tS+*qt);\n+\tt[2]=S[2]+(P[2]-S[2])*(*tS)/(*Pq+*tS+*qt);\n+\t/*==================================================================*/\n+\t*Pq=sqrt((*Pq)*(*Pq)+(q[2]-P[2])*(q[2]-P[2]));\n+\t*tS=sqrt((*tS)*(*tS)+(t[2]-S[2])*(t[2]-S[2]));\n+\t*qt=sqrt((*qt)*(*qt)+(q[2]-t[2])*(q[2]-t[2]));\t*L = *Pq + *qt + *tS;\n+\t/*==================================================================*/\n+\t*active=1;\t/* ACTIVE */\n+\treturn(0);\n }\n /*============================================================================*/\n \n@@ -676,184 +674,184 @@ static int single_cylinder(double R,double P[3],double q[3],double t[3],double S\n static int double_cylinder(double U[3],double Ru,double V[3],double Rv,double M[9],\n    double P[3],double q[3],double Q[3],double T[3],double t[3],double S[3],\n    double *Pq,double *qQ,double *QT,double *Tt,double *tS,double *L,\n-    int *active,double *ru,double *rv) {\n-\n-    double Qd,Qrt,Qc,Td,Trt,Tc,TQ,LU,LV,TnU[3],QnV[3];\n-    double x[3],C[3],Cx[9];\n-    double dQdx[9],dTdQ[9];\n-    double dp,ds,rtp,rts,z1,z2,buff,Rpos,sgn;\n-    int i,count=0,MAXCOUNT=50;\n-\n-    *ru=Ru; *rv=Rv;\n-\n-    if(*active!=3) switch(*active) {\n-    /*==================================================================*/\n-    /*=== RESPOND TO CURRENT INACTIVE STATE OF ONE OR BOTH CYLINDERS ===*/\n-    /*==================================================================*/\n-    case 0: /* NEITHER CYLINDER IS ACTIVE */\n-        q[0]=P[0]; q[1]=P[1]; q[2]=P[2];        Q[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\n-        T[0]=S[0]; T[1]=S[1]; T[2]=S[2];        t[0]=S[0]; t[1]=S[1]; t[2]=S[2];\n-        quick_mul_vec_by_mtx(S,M,C);    quick_add_vec_to_vec(C,V,C);\n-        *Pq=0.0;    *qQ=0.0;        *L=*QT=DISTANCE_BETWEEN(P,C);       *Tt=0.0;    *tS=0.0;\n-        if(path_inside_radius(P,C,Ru)) {    *active=1;  RETURN_DOUBLE; }\n-        quick_mul_vec_by_mtxT(P,M,C); quick_add_vec_to_vec(C,U,C);\n-        if(path_inside_radius(C,S,Rv)) {    *active=2;  RETURN_DOUBLE; } return(0);\n-    /*==================================================================*/\n-    case 1: /* U CYLINDER IS ACTIVE ALONE */\n-        T[0]=S[0]; T[1]=S[1]; T[2]=S[2];        t[0]=S[0]; t[1]=S[1]; t[2]=S[2];\n-        quick_mul_vec_by_mtx(S,M,C); quick_add_vec_to_vec(C,V,C); *Tt=0.0;*tS=0.0;\n-        i=1;    single_cylinder(Ru,P,q,Q,C,Pq,qQ,QT,L,&i,ru);\n-        if(!i) {    Q[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];    /* NIETHER SHOULD BE ACTIVE */\n-            *QT=*qQ;    *qQ=0.0; *active=0;\n-            quick_mul_vec_by_mtxT(P,M,C); quick_add_vec_to_vec(C,U,C);  /*=2?*/\n-            if(path_inside_radius(C,S,Rv)) {    *active=2;  RETURN_DOUBLE; }\n-            return(0);\n-        }\n-        quick_mul_vec_by_mtxT(Q,M,C); quick_add_vec_to_vec(C,U,C);\n-        if(path_inside_radius(C,S,Rv)) {    *active=3;  RETURN_DOUBLE; } return(0);\n-    /*==================================================================*/\n-    case 2: /* V CYLINDER IS ACTIVE ALONE */\n-        q[0]=P[0]; q[1]=P[1]; q[2]=P[2];        Q[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\n-        quick_mul_vec_by_mtxT(P,M,C); quick_add_vec_to_vec(C,U,C);*Pq=0.0;*qQ=0.0;\n-        i=1;    single_cylinder(Rv,C,T,t,S,QT,Tt,tS,L,&i,rv);\n-        if(!i) {    T[0]=S[0]; T[1]=S[1]; T[2]=S[2]; /* NIETHER SHOULD BE ACTIVE */\n-            *QT=*Tt; *Tt=0.0; *active=0; return(0); }\n-        quick_mul_vec_by_mtx(T,M,C);    quick_add_vec_to_vec(C,V,C);\n-        if(path_inside_radius(P,C,Ru)) { *active=3; RETURN_DOUBLE; } return(0);\n-    }\n-    /*==================================================================*/\n-\n-    /*==================================================================*/\n-    /*=== COMPUTE COMPONENTS OF q AND t WHICH DEPEND ONLY ON P AND S ===*/\n-    /*==================================================================*/\n-    x[0]=T[0];  x[1]=T[1];  x[2]=T[2];\n-    /*==================================================================*/\n-    dp=P[0]*P[0]+P[1]*P[1]; rtp=dp-Ru*Ru;\n-    sgn=SIGN(Ru);   Rpos=ABS(Ru);   buff=(Rpos+OBST_BUFF)*(Rpos+OBST_BUFF);\n-    if(dp<OBST_BUFF) return(0);                         /* NO ROOM TO SHRINK */\n-    if(dp<buff) {                    /* POINT IS INSIDE CYLINDER SO SHRINK IT */\n-        Ru=sgn*(sqrt(dp)-OBST_BUFF);    rtp=dp-Ru*Ru; }\n-    /*==================================================================*/\n-    ds=S[0]*S[0]+S[1]*S[1]; rts=ds-Rv*Rv;\n-    sgn=SIGN(Rv);   Rpos=ABS(Rv);   buff=(Rpos+OBST_BUFF)*(Rpos+OBST_BUFF);\n-    if(ds<OBST_BUFF) return(0);                         /* NO ROOM TO SHRINK */\n-    if(ds<buff) {                    /* POINT IS INSIDE CYLINDER SO SHRINK IT */\n-        Rv=sgn*(sqrt(ds)-OBST_BUFF);    rts=ds-Rv*Rv; }\n-    /*==================================================================*/\n-    *ru=Ru; *rv=Rv;                 dp=Ru/dp; rtp=sqrt(rtp);\n-    q[0]=(Ru*P[0]-rtp*P[1])*dp; q[1]=(Ru*P[1]+rtp*P[0])*dp;\n-    ds=Rv/ds; rts=sqrt(rts);\n-    t[0]=(Rv*S[0]+rts*S[1])*ds; t[1]=(Rv*S[1]-rts*S[0])*ds;\n-    *Pq=sqrt((q[0]-P[0])*(q[0]-P[0])+(q[1]-P[1])*(q[1]-P[1]));\n-    *tS=sqrt((t[0]-S[0])*(t[0]-S[0])+(t[1]-S[1])*(t[1]-S[1]));\n-    /*==================================================================*/\n-\n-    /*==================================================================*/\n-    /*======== ITERATIVELY CONVERGE ON DOUBLE CYLINDER SOLUTION ========*/\n-    /*==================================================================*/\n-    for(count=0;count<MAXCOUNT;count++) {\n-        /*===============================================================*/\n-        /*======= COMPUTE CONSTRAINTS WHICH REPRESENT CONVERGENCE =======*/\n-        /*===============================================================*/\n-        quick_mul_vec_by_mtx(x,M,TnU);  quick_add_vec_to_vec(TnU,V,TnU);    \n-        /*===============================================================*/\n-        Td=TnU[0]*TnU[0]+TnU[1]*TnU[1]; Trt=Td-Ru*Ru;   Td=Ru/Td;\n-        if(Trt<0.0) return(-1); Trt=sqrt(Trt);\n-        Q[0]=(Ru*TnU[0]+Trt*TnU[1])*Td; Q[1]=(Ru*TnU[1]-Trt*TnU[0])*Td;\n-        /*===============================================================*/\n-        *QT=sqrt((TnU[0]-Q[0])*(TnU[0]-Q[0])+(TnU[1]-Q[1])*(TnU[1]-Q[1]));\n-        Tc=1.0-0.5*((q[0]-Q[0])*(q[0]-Q[0])+(q[1]-Q[1])*(q[1]-Q[1]))/(Ru*Ru);\n-        if(fabs(Tc)>=1.0) *qQ=fabs(Ru*SimTK::Pi); else  *qQ=fabs(Ru*acos(Tc));\n-        /*===============================================================*/\n-        LU=1.0/(*Pq+*QT+*qQ);\n-        q[2]=P[2]+(TnU[2]-P[2])*(*Pq)*LU;\n-        Q[2]=TnU[2]+(P[2]-TnU[2])*(*QT)*LU;\n-        /*===============================================================*/\n-        quick_mul_vec_by_mtxT(Q,M,QnV); quick_add_vec_to_vec(QnV,U,QnV);\n-        /*===============================================================*/\n-        Qd=QnV[0]*QnV[0]+QnV[1]*QnV[1]; Qrt=Qd-Rv*Rv;   Qd=Rv/Qd;\n-        if(Qrt<0.0) return(-1); Qrt=sqrt(Qrt);\n-        T[0]=(Rv*QnV[0]-Qrt*QnV[1])*Qd; T[1]=(Rv*QnV[1]+Qrt*QnV[0])*Qd;\n-        /*===============================================================*/\n-        TQ=sqrt((T[0]-QnV[0])*(T[0]-QnV[0])+(T[1]-QnV[1])*(T[1]-QnV[1]));\n-        Qc=1.0-0.5*((t[0]-T[0])*(t[0]-T[0])+(t[1]-T[1])*(t[1]-T[1]))/(Rv*Rv);\n-        if(fabs(Qc)>=1.0) *Tt=fabs(Rv*SimTK::Pi); else  *Tt=fabs(Rv*acos(Qc));\n-        /*===============================================================*/\n-        LV=1.0/(*tS+TQ+*Tt);\n-        t[2]=S[2]+(QnV[2]-S[2])*(*tS)*LV;\n-        T[2]=QnV[2]+(S[2]-QnV[2])*(TQ)*LV;\n-        /*===============================================================*/\n-        C[0]=T[0]-x[0]; C[1]=T[1]-x[1]; C[2]=T[2]-x[2];\n-        /*===============================================================*/\n-    \n-        if(fabs(C[0])+fabs(C[1])+fabs(C[2])<1.0e-12) break; /* CONVERGED */\n-    \n-        /*===============================================================*/\n-        /*========= COMPUTE ANALYTICAL GRADIENTS OF CONSTRAINTS =========*/\n-        /*===============================================================*/\n-        rtp=1/Trt;  dp=1/Ru;\n-        dQdx[0]=  (Ru +TnU[0]*TnU[1]*rtp-2*TnU[0]*Q[0]*dp)*Td;\n-        dQdx[1]=  (Trt+TnU[1]*TnU[1]*rtp-2*TnU[1]*Q[0]*dp)*Td;  dQdx[2]=0.0;\n-        dQdx[3]= -(Trt+TnU[0]*TnU[0]*rtp+2*TnU[0]*Q[1]*dp)*Td;\n-        dQdx[4]=  (Ru -TnU[0]*TnU[1]*rtp-2*TnU[1]*Q[1]*dp)*Td;  dQdx[5]=0.0;\n-        z1= *QT*(P[2]-TnU[2])*LU*LU;        z2=(P[2]-TnU[2])*LU-z1;\n-        rtp=(*qQ>=0.0?1.0:-1.0)*Ru/sqrt(1.0-Tc*Tc);\n-        dQdx[6]= z2*((Q[0]-TnU[0])*(dQdx[0]-1.0)+(Q[1]-TnU[1])*dQdx[3])/(*QT) +\n-                    z1*rtp*((Q[0]-q[0])*dQdx[0]+(Q[1]-q[1])*dQdx[3])/(Ru*Ru);\n-        dQdx[7]= z2*((Q[0]-TnU[0])*dQdx[1]+(Q[1]-TnU[1])*(dQdx[4]-1.0))/(*QT) +\n-                    z1*rtp*((Q[0]-q[0])*dQdx[1]+(Q[1]-q[1])*dQdx[4])/(Ru*Ru);\n-        dQdx[8]=1-(*QT)*LU;\n-        /*===============================================================*/\n-        quick_mul_mtxT_by_mtx(M,dQdx,Cx);   /* Cx USED AS TMP STORAGE */\n-        quick_mul_mtx_by_mtx(Cx,M,dQdx);\n-        /*===============================================================*/\n-        rtp=1/Qrt;  dp=1/Rv;\n-        dTdQ[0]=  (Rv -QnV[0]*QnV[1]*rtp-2*QnV[0]*T[0]*dp)*Qd;\n-        dTdQ[1]= -(Qrt+QnV[1]*QnV[1]*rtp+2*QnV[1]*T[0]*dp)*Qd; dTdQ[2]=0.0;\n-        dTdQ[3]=  (Qrt+QnV[0]*QnV[0]*rtp-2*QnV[0]*T[1]*dp)*Qd;\n-        dTdQ[4]=  (Rv +QnV[0]*QnV[1]*rtp-2*QnV[1]*T[1]*dp)*Qd; dTdQ[5]=0.0;\n-        z1=TQ*(S[2]-QnV[2])*LV*LV;      z2=(S[2]-QnV[2])*LV-z1;\n-        rtp=(*Tt>0.0?1.0:-1.0)*Rv/sqrt(1.0-Qc*Qc);\n-        dTdQ[6]= z2*((T[0]-QnV[0])*(dTdQ[0]-1.0)+(T[1]-QnV[1])*dTdQ[3])/TQ +\n-                    z1*rtp*((T[0]-t[0])*dTdQ[0]+(T[1]-t[1])*dTdQ[3])/(Rv*Rv);\n-        dTdQ[7]= z2*((T[0]-QnV[0])*dTdQ[1]+(T[1]-QnV[1])*(dTdQ[4]-1.0))/TQ +\n-                    z1*rtp*((T[0]-t[0])*dTdQ[1]+(T[1]-t[1])*dTdQ[4])/(Rv*Rv);\n-        dTdQ[8]=  1-TQ*LV;\n-        /*===============================================================*/\n-        quick_mul_mtx_by_mtx(dTdQ,dQdx,Cx); Cx[0]-=1.0; Cx[4]-=1.0; Cx[8]-=1.0;\n-        quick_solve_linear(3,Cx,C,C);   quick_sub_vec_fm_vec(x,C,x);    /* UPDATE x */\n-        /*===============================================================*/\n-    }   T[0]=x[0];  T[1]=x[1];  T[2]=x[2];  /*== APPLY SOLUTION ==*/\n-    if(count>=MAXCOUNT) {\n-        printf("double_cyl: Unable to converge.\\n");\n-        return(-1);\n-    }\n-    /*==================================================================*/\n-\n-    /*==================================================================*/\n-    /*====== CHECK CYLINDERS TO SEE IF THEY SHOULD REMAIN ACTIVE =======*/\n-    /*==================================================================*/\n-    if(Ru*(Q[0]*q[1]-Q[1]*q[0])>0.0) {  /* U CYLINDER SHOULD BE INACTIVE */\n-        q[0]=P[0]; q[1]=P[1]; q[2]=P[2];        Q[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\n-        quick_mul_vec_by_mtxT(P,M,C);   quick_add_vec_to_vec(C,U,C);    *active=2;\n-        i=1;    single_cylinder(Rv,C,T,t,S,QT,Tt,tS,L,&i,rv);   *Pq=0.0;    *qQ=0.0;\n-        if(!i) { *active=0; return(0); }    /* NIETHER CYLINDER SHOULD BE ACTIVE */\n-    } else\n-    if(Rv*(t[0]*T[1]-t[1]*T[0])>0.0) {  /* V CYLINDER SHOULD BE INACTIVE */\n-        t[0]=S[0]; t[1]=S[1]; t[2]=S[2];        T[0]=S[0]; T[1]=S[1]; T[2]=S[2];\n-        quick_mul_vec_by_mtx(S,M,C);    quick_add_vec_to_vec(C,V,C);    *active=1;\n-        i=1;    single_cylinder(Ru,P,q,Q,C,Pq,qQ,QT,L,&i,ru);   *tS=0.0;    *Tt=0.0;\n-        if(!i) { *active=0; return(0); }    /* NIETHER CYLINDER SHOULD BE ACTIVE */\n-    } else { *active=3;                     /* BOTH CYLINDERS SHOULD REMAIN ACTIVE */\n-        *Pq=sqrt((*Pq)*(*Pq)+(q[2]-P[2])*(q[2]-P[2]));\n-        *qQ=sqrt((*qQ)*(*qQ)+(Q[2]-q[2])*(Q[2]-q[2]));\n-        *QT=sqrt(TQ*TQ+(T[2]-QnV[2])*(T[2]-QnV[2]));\n-        *Tt=sqrt((*Tt)*(*Tt)+(t[2]-T[2])*(t[2]-T[2]));\n-        *tS=sqrt((*tS)*(*tS)+(S[2]-t[2])*(S[2]-t[2]));\n-        *L = *Pq + *qQ + *QT + *Tt + *tS;\n-    }\n-    /*==================================================================*/\n-    return(0);\n+\tint *active,double *ru,double *rv) {\n+\n+\tdouble Qd,Qrt,Qc,Td,Trt,Tc,TQ,LU,LV,TnU[3],QnV[3];\n+\tdouble x[3],C[3],Cx[9];\n+\tdouble dQdx[9],dTdQ[9];\n+\tdouble dp,ds,rtp,rts,z1,z2,buff,Rpos,sgn;\n+\tint i,count=0,MAXCOUNT=50;\n+\n+\t*ru=Ru;\t*rv=Rv;\n+\n+\tif(*active!=3) switch(*active) {\n+\t/*==================================================================*/\n+\t/*=== RESPOND TO CURRENT INACTIVE STATE OF ONE OR BOTH CYLINDERS ===*/\n+\t/*==================================================================*/\n+\tcase 0:\t/* NEITHER CYLINDER IS ACTIVE */\n+\t\tq[0]=P[0]; q[1]=P[1]; q[2]=P[2];\t\tQ[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\n+\t\tT[0]=S[0]; T[1]=S[1]; T[2]=S[2];\t\tt[0]=S[0]; t[1]=S[1]; t[2]=S[2];\n+\t\tquick_mul_vec_by_mtx(S,M,C);\tquick_add_vec_to_vec(C,V,C);\n+\t\t*Pq=0.0;\t*qQ=0.0;\t\t*L=*QT=DISTANCE_BETWEEN(P,C);\t\t*Tt=0.0;\t*tS=0.0;\n+\t\tif(path_inside_radius(P,C,Ru)) {\t*active=1;\tRETURN_DOUBLE; }\n+\t\tquick_mul_vec_by_mtxT(P,M,C); quick_add_vec_to_vec(C,U,C);\n+\t\tif(path_inside_radius(C,S,Rv)) {\t*active=2;\tRETURN_DOUBLE; } return(0);\n+\t/*==================================================================*/\n+\tcase 1:\t/* U CYLINDER IS ACTIVE ALONE */\n+\t\tT[0]=S[0]; T[1]=S[1]; T[2]=S[2];\t\tt[0]=S[0]; t[1]=S[1]; t[2]=S[2];\n+\t\tquick_mul_vec_by_mtx(S,M,C); quick_add_vec_to_vec(C,V,C); *Tt=0.0;*tS=0.0;\n+\t\ti=1;\tsingle_cylinder(Ru,P,q,Q,C,Pq,qQ,QT,L,&i,ru);\n+\t\tif(!i) {\tQ[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\t/* NIETHER SHOULD BE ACTIVE */\n+\t\t\t*QT=*qQ;\t*qQ=0.0; *active=0;\n+\t\t\tquick_mul_vec_by_mtxT(P,M,C); quick_add_vec_to_vec(C,U,C);\t/*=2?*/\n+\t\t\tif(path_inside_radius(C,S,Rv)) {\t*active=2;\tRETURN_DOUBLE; }\n+\t\t\treturn(0);\n+\t\t}\n+\t\tquick_mul_vec_by_mtxT(Q,M,C); quick_add_vec_to_vec(C,U,C);\n+\t\tif(path_inside_radius(C,S,Rv)) {\t*active=3;\tRETURN_DOUBLE; } return(0);\n+\t/*==================================================================*/\n+\tcase 2:\t/* V CYLINDER IS ACTIVE ALONE */\n+\t\tq[0]=P[0]; q[1]=P[1]; q[2]=P[2];\t\tQ[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\n+\t\tquick_mul_vec_by_mtxT(P,M,C); quick_add_vec_to_vec(C,U,C);*Pq=0.0;*qQ=0.0;\n+\t\ti=1;\tsingle_cylinder(Rv,C,T,t,S,QT,Tt,tS,L,&i,rv);\n+\t\tif(!i) {\tT[0]=S[0]; T[1]=S[1]; T[2]=S[2]; /* NIETHER SHOULD BE ACTIVE */\n+\t\t\t*QT=*Tt; *Tt=0.0; *active=0; return(0); }\n+\t\tquick_mul_vec_by_mtx(T,M,C);\tquick_add_vec_to_vec(C,V,C);\n+\t\tif(path_inside_radius(P,C,Ru)) { *active=3;\tRETURN_DOUBLE; } return(0);\n+\t}\n+\t/*==================================================================*/\n+\n+\t/*==================================================================*/\n+\t/*=== COMPUTE COMPONENTS OF q AND t WHICH DEPEND ONLY ON P AND S ===*/\n+\t/*==================================================================*/\n+\tx[0]=T[0];\tx[1]=T[1];\tx[2]=T[2];\n+\t/*==================================================================*/\n+\tdp=P[0]*P[0]+P[1]*P[1];\trtp=dp-Ru*Ru;\n+\tsgn=SIGN(Ru);\tRpos=ABS(Ru);\tbuff=(Rpos+OBST_BUFF)*(Rpos+OBST_BUFF);\n+\tif(dp<OBST_BUFF) return(0);\t\t\t\t\t\t\t/* NO ROOM TO SHRINK */\n+\tif(dp<buff) {\t\t\t\t\t /* POINT IS INSIDE CYLINDER SO SHRINK IT */\n+\t\tRu=sgn*(sqrt(dp)-OBST_BUFF);\trtp=dp-Ru*Ru; }\n+\t/*==================================================================*/\n+\tds=S[0]*S[0]+S[1]*S[1];\trts=ds-Rv*Rv;\n+\tsgn=SIGN(Rv);\tRpos=ABS(Rv);\tbuff=(Rpos+OBST_BUFF)*(Rpos+OBST_BUFF);\n+\tif(ds<OBST_BUFF) return(0);\t\t\t\t\t\t\t/* NO ROOM TO SHRINK */\n+\tif(ds<buff) {\t\t\t\t\t /* POINT IS INSIDE CYLINDER SO SHRINK IT */\n+\t\tRv=sgn*(sqrt(ds)-OBST_BUFF);\trts=ds-Rv*Rv; }\n+\t/*==================================================================*/\n+\t*ru=Ru;\t*rv=Rv;\t\t\t\t\tdp=Ru/dp; rtp=sqrt(rtp);\n+\tq[0]=(Ru*P[0]-rtp*P[1])*dp; q[1]=(Ru*P[1]+rtp*P[0])*dp;\n+\tds=Rv/ds; rts=sqrt(rts);\n+\tt[0]=(Rv*S[0]+rts*S[1])*ds; t[1]=(Rv*S[1]-rts*S[0])*ds;\n+\t*Pq=sqrt((q[0]-P[0])*(q[0]-P[0])+(q[1]-P[1])*(q[1]-P[1]));\n+\t*tS=sqrt((t[0]-S[0])*(t[0]-S[0])+(t[1]-S[1])*(t[1]-S[1]));\n+\t/*==================================================================*/\n+\n+\t/*==================================================================*/\n+\t/*======== ITERATIVELY CONVERGE ON DOUBLE CYLINDER SOLUTION ========*/\n+\t/*==================================================================*/\n+\tfor(count=0;count<MAXCOUNT;count++) {\n+\t\t/*===============================================================*/\n+\t\t/*======= COMPUTE CONSTRAINTS WHICH REPRESENT CONVERGENCE =======*/\n+\t\t/*===============================================================*/\n+\t\tquick_mul_vec_by_mtx(x,M,TnU);\tquick_add_vec_to_vec(TnU,V,TnU);\t\n+\t\t/*===============================================================*/\n+\t\tTd=TnU[0]*TnU[0]+TnU[1]*TnU[1];\tTrt=Td-Ru*Ru;\tTd=Ru/Td;\n+\t\tif(Trt<0.0) return(-1); Trt=sqrt(Trt);\n+\t\tQ[0]=(Ru*TnU[0]+Trt*TnU[1])*Td;\tQ[1]=(Ru*TnU[1]-Trt*TnU[0])*Td;\n+\t\t/*===============================================================*/\n+\t\t*QT=sqrt((TnU[0]-Q[0])*(TnU[0]-Q[0])+(TnU[1]-Q[1])*(TnU[1]-Q[1]));\n+\t\tTc=1.0-0.5*((q[0]-Q[0])*(q[0]-Q[0])+(q[1]-Q[1])*(q[1]-Q[1]))/(Ru*Ru);\n+\t\tif(fabs(Tc)>=1.0) *qQ=fabs(Ru*SimTK::Pi); else\t*qQ=fabs(Ru*acos(Tc));\n+\t\t/*===============================================================*/\n+\t\tLU=1.0/(*Pq+*QT+*qQ);\n+\t\tq[2]=P[2]+(TnU[2]-P[2])*(*Pq)*LU;\n+\t\tQ[2]=TnU[2]+(P[2]-TnU[2])*(*QT)*LU;\n+\t\t/*===============================================================*/\n+\t\tquick_mul_vec_by_mtxT(Q,M,QnV);\tquick_add_vec_to_vec(QnV,U,QnV);\n+\t\t/*===============================================================*/\n+\t\tQd=QnV[0]*QnV[0]+QnV[1]*QnV[1];\tQrt=Qd-Rv*Rv;\tQd=Rv/Qd;\n+\t\tif(Qrt<0.0) return(-1); Qrt=sqrt(Qrt);\n+\t\tT[0]=(Rv*QnV[0]-Qrt*QnV[1])*Qd;\tT[1]=(Rv*QnV[1]+Qrt*QnV[0])*Qd;\n+\t\t/*===============================================================*/\n+\t\tTQ=sqrt((T[0]-QnV[0])*(T[0]-QnV[0])+(T[1]-QnV[1])*(T[1]-QnV[1]));\n+\t\tQc=1.0-0.5*((t[0]-T[0])*(t[0]-T[0])+(t[1]-T[1])*(t[1]-T[1]))/(Rv*Rv);\n+\t\tif(fabs(Qc)>=1.0) *Tt=fabs(Rv*SimTK::Pi); else\t*Tt=fabs(Rv*acos(Qc));\n+\t\t/*===============================================================*/\n+\t\tLV=1.0/(*tS+TQ+*Tt);\n+\t\tt[2]=S[2]+(QnV[2]-S[2])*(*tS)*LV;\n+\t\tT[2]=QnV[2]+(S[2]-QnV[2])*(TQ)*LV;\n+\t\t/*===============================================================*/\n+\t\tC[0]=T[0]-x[0];\tC[1]=T[1]-x[1];\tC[2]=T[2]-x[2];\n+\t\t/*===============================================================*/\n+\t\n+\t\tif(fabs(C[0])+fabs(C[1])+fabs(C[2])<1.0e-12) break;\t/* CONVERGED */\n+\t\n+\t\t/*===============================================================*/\n+\t\t/*========= COMPUTE ANALYTICAL GRADIENTS OF CONSTRAINTS =========*/\n+\t\t/*===============================================================*/\n+\t\trtp=1/Trt;\tdp=1/Ru;\n+\t\tdQdx[0]=  (Ru +TnU[0]*TnU[1]*rtp-2*TnU[0]*Q[0]*dp)*Td;\n+\t\tdQdx[1]=  (Trt+TnU[1]*TnU[1]*rtp-2*TnU[1]*Q[0]*dp)*Td;\tdQdx[2]=0.0;\n+\t\tdQdx[3]= -(Trt+TnU[0]*TnU[0]*rtp+2*TnU[0]*Q[1]*dp)*Td;\n+\t\tdQdx[4]=  (Ru -TnU[0]*TnU[1]*rtp-2*TnU[1]*Q[1]*dp)*Td;\tdQdx[5]=0.0;\n+\t\tz1= *QT*(P[2]-TnU[2])*LU*LU;\t\tz2=(P[2]-TnU[2])*LU-z1;\n+\t\trtp=(*qQ>=0.0?1.0:-1.0)*Ru/sqrt(1.0-Tc*Tc);\n+\t\tdQdx[6]= z2*((Q[0]-TnU[0])*(dQdx[0]-1.0)+(Q[1]-TnU[1])*dQdx[3])/(*QT) +\n+\t\t\t\t\tz1*rtp*((Q[0]-q[0])*dQdx[0]+(Q[1]-q[1])*dQdx[3])/(Ru*Ru);\n+\t\tdQdx[7]= z2*((Q[0]-TnU[0])*dQdx[1]+(Q[1]-TnU[1])*(dQdx[4]-1.0))/(*QT) +\n+\t\t\t\t\tz1*rtp*((Q[0]-q[0])*dQdx[1]+(Q[1]-q[1])*dQdx[4])/(Ru*Ru);\n+\t\tdQdx[8]=1-(*QT)*LU;\n+\t\t/*===============================================================*/\n+\t\tquick_mul_mtxT_by_mtx(M,dQdx,Cx);\t/* Cx USED AS TMP STORAGE */\n+\t\tquick_mul_mtx_by_mtx(Cx,M,dQdx);\n+\t\t/*===============================================================*/\n+\t\trtp=1/Qrt;\tdp=1/Rv;\n+\t\tdTdQ[0]=  (Rv -QnV[0]*QnV[1]*rtp-2*QnV[0]*T[0]*dp)*Qd;\n+\t\tdTdQ[1]= -(Qrt+QnV[1]*QnV[1]*rtp+2*QnV[1]*T[0]*dp)*Qd; dTdQ[2]=0.0;\n+\t\tdTdQ[3]=  (Qrt+QnV[0]*QnV[0]*rtp-2*QnV[0]*T[1]*dp)*Qd;\n+\t\tdTdQ[4]=  (Rv +QnV[0]*QnV[1]*rtp-2*QnV[1]*T[1]*dp)*Qd; dTdQ[5]=0.0;\n+\t\tz1=TQ*(S[2]-QnV[2])*LV*LV;\t\tz2=(S[2]-QnV[2])*LV-z1;\n+\t\trtp=(*Tt>0.0?1.0:-1.0)*Rv/sqrt(1.0-Qc*Qc);\n+\t\tdTdQ[6]= z2*((T[0]-QnV[0])*(dTdQ[0]-1.0)+(T[1]-QnV[1])*dTdQ[3])/TQ +\n+\t\t\t\t\tz1*rtp*((T[0]-t[0])*dTdQ[0]+(T[1]-t[1])*dTdQ[3])/(Rv*Rv);\n+\t\tdTdQ[7]= z2*((T[0]-QnV[0])*dTdQ[1]+(T[1]-QnV[1])*(dTdQ[4]-1.0))/TQ +\n+\t\t\t\t\tz1*rtp*((T[0]-t[0])*dTdQ[1]+(T[1]-t[1])*dTdQ[4])/(Rv*Rv);\n+\t\tdTdQ[8]=  1-TQ*LV;\n+\t\t/*===============================================================*/\n+\t\tquick_mul_mtx_by_mtx(dTdQ,dQdx,Cx);\tCx[0]-=1.0;\tCx[4]-=1.0;\tCx[8]-=1.0;\n+\t\tquick_solve_linear(3,Cx,C,C);\tquick_sub_vec_fm_vec(x,C,x);\t/* UPDATE x */\n+\t\t/*===============================================================*/\n+\t}\tT[0]=x[0];\tT[1]=x[1];\tT[2]=x[2];\t/*== APPLY SOLUTION ==*/\n+\tif(count>=MAXCOUNT) {\n+\t\tprintf("double_cyl: Unable to converge.\\n");\n+\t\treturn(-1);\n+\t}\n+\t/*==================================================================*/\n+\n+\t/*==================================================================*/\n+\t/*====== CHECK CYLINDERS TO SEE IF THEY SHOULD REMAIN ACTIVE =======*/\n+\t/*==================================================================*/\n+\tif(Ru*(Q[0]*q[1]-Q[1]*q[0])>0.0) {\t/* U CYLINDER SHOULD BE INACTIVE */\n+\t\tq[0]=P[0]; q[1]=P[1]; q[2]=P[2];\t\tQ[0]=P[0]; Q[1]=P[1]; Q[2]=P[2];\n+\t\tquick_mul_vec_by_mtxT(P,M,C);\tquick_add_vec_to_vec(C,U,C);\t*active=2;\n+\t\ti=1;\tsingle_cylinder(Rv,C,T,t,S,QT,Tt,tS,L,&i,rv);\t*Pq=0.0;\t*qQ=0.0;\n+\t\tif(!i) { *active=0; return(0); }\t/* NIETHER CYLINDER SHOULD BE ACTIVE */\n+\t} else\n+\tif(Rv*(t[0]*T[1]-t[1]*T[0])>0.0) {\t/* V CYLINDER SHOULD BE INACTIVE */\n+\t\tt[0]=S[0]; t[1]=S[1]; t[2]=S[2];\t\tT[0]=S[0]; T[1]=S[1]; T[2]=S[2];\n+\t\tquick_mul_vec_by_mtx(S,M,C);\tquick_add_vec_to_vec(C,V,C);\t*active=1;\n+\t\ti=1;\tsingle_cylinder(Ru,P,q,Q,C,Pq,qQ,QT,L,&i,ru);\t*tS=0.0;\t*Tt=0.0;\n+\t\tif(!i) { *active=0; return(0); }\t/* NIETHER CYLINDER SHOULD BE ACTIVE */\n+\t} else { *active=3;\t\t\t\t\t\t/* BOTH CYLINDERS SHOULD REMAIN ACTIVE */\n+\t\t*Pq=sqrt((*Pq)*(*Pq)+(q[2]-P[2])*(q[2]-P[2]));\n+\t\t*qQ=sqrt((*qQ)*(*qQ)+(Q[2]-q[2])*(Q[2]-q[2]));\n+\t\t*QT=sqrt(TQ*TQ+(T[2]-QnV[2])*(T[2]-QnV[2]));\n+\t\t*Tt=sqrt((*Tt)*(*Tt)+(t[2]-T[2])*(t[2]-T[2]));\n+\t\t*tS=sqrt((*tS)*(*tS)+(S[2]-t[2])*(S[2]-t[2]));\n+\t\t*L = *Pq + *qQ + *QT + *Tt + *tS;\n+\t}\n+\t/*==================================================================*/\n+\treturn(0);\n \n }\n /*============================================================================*/\ndiff --git a/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.h b/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.h\nindex ee6ecf560..4fed1fde7 100644\n--- a/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.h\n+++ b/OpenSim/Simulation/Wrap/WrapDoubleCylinderObst.h\n@@ -26,13 +26,11 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n #include <OpenSim/Simulation/Wrap/WrapObject.h>\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathPoint;\ndiff --git a/OpenSim/Simulation/Wrap/WrapEllipsoid.cpp b/OpenSim/Simulation/Wrap/WrapEllipsoid.cpp\nindex 704c39147..89e09a9f7 100644\n--- a/OpenSim/Simulation/Wrap/WrapEllipsoid.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapEllipsoid.cpp\n@@ -60,8 +60,8 @@ WrapEllipsoid::WrapEllipsoid() :\n    WrapObject(),\n    _dimensions(_dimensionsProp.getValueDblArray())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -82,9 +82,9 @@ WrapEllipsoid::WrapEllipsoid(const WrapEllipsoid& aWrapEllipsoid) :\n    WrapObject(aWrapEllipsoid),\n    _dimensions(_dimensionsProp.getValueDblArray())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapEllipsoid);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapEllipsoid);\n }\n \n //=============================================================================\n@@ -104,13 +104,13 @@ void WrapEllipsoid::setNull()\n */\n void WrapEllipsoid::setupProperties()\n {\n-    // BASE CLASS\n-    //WrapObject::setupProperties();\n+\t// BASE CLASS\n+\t//WrapObject::setupProperties();\n \n-    const double defaultDimensions[] = {-1.0, -1.0, -1.0};\n-    _dimensionsProp.setName("dimensions");\n-    _dimensionsProp.setValue(3, defaultDimensions);\n-    _propertySet.append(&_dimensionsProp);\n+\tconst double defaultDimensions[] = {-1.0, -1.0, -1.0};\n+\t_dimensionsProp.setName("dimensions");\n+\t_dimensionsProp.setValue(3, defaultDimensions);\n+\t_propertySet.append(&_dimensionsProp);\n }\n \n //_____________________________________________________________________________\n@@ -122,21 +122,19 @@ void WrapEllipsoid::setupProperties()\n */\n void WrapEllipsoid::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n {\n-    // Base class\n-    WrapObject::connectToModelAndBody(aModel, aBody);\n-\n-    // maybe set a parent pointer, _body = aBody;\n-\n-    if (_dimensions[0] < 0.0 || _dimensions[1] < 0.0 || _dimensions[2] < 0.0)\n-    {\n-        string errorMessage = "Error: dimensions for WrapEllipsoid " + getName() + " were either not specified, or are negative.";\n-        throw Exception(errorMessage);\n-    }\n-    _displayer.freeGeometry();\n-    AnalyticEllipsoid* ellipsoid = new AnalyticEllipsoid();\n-    ellipsoid->setEllipsoidParams(_dimensions[0], _dimensions[1], _dimensions[2]);\n-    setGeometryQuadrants(ellipsoid);\n-    _displayer.addGeometry(ellipsoid);\n+\t// Base class\n+\tWrapObject::connectToModelAndBody(aModel, aBody);\n+\n+\t// maybe set a parent pointer, _body = aBody;\n+\n+\tif (_dimensions[0] < 0.0 || _dimensions[1] < 0.0 || _dimensions[2] < 0.0)\n+\t{\n+\t\tstring errorMessage = "Error: dimensions for WrapEllipsoid " + getName() + " were either not specified, or are negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\tAnalyticEllipsoid* ellipsoid = new AnalyticEllipsoid();\n+\tellipsoid->setEllipsoidParams(_dimensions[0], _dimensions[1], _dimensions[2]);\n+\tsetGeometryQuadrants(ellipsoid);\n }\n \n //_____________________________________________________________________________\n@@ -151,19 +149,19 @@ void WrapEllipsoid::scale(const SimTK::Vec3& aScaleFactors)\n    // Base class, to scale origin in body frame\n    WrapObject::scale(aScaleFactors);\n \n-    SimTK::Vec3 localScaleVector[3];\n+\tSimTK::Vec3 localScaleVector[3];\n \n    // _pose.x() holds the ellipsoid\'s X axis expressed in the\n    // body\'s reference frame. The magnitude of this-vector-multiplied-\n    // by-the-XYZ-scale-factors gives the amount that you need to\n    // scale the X dimension of the ellipsoid. Similarly for Y and Z...\n-    for (int i=0; i<3; i++) {\n-        localScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i];\n-        localScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i];\n-        localScaleVector[2][i] = _pose.z()[i] * aScaleFactors[i];\n-    }\n-    for (int i=0; i<3; i++)\n-        _dimensions[i] *= localScaleVector[i].norm();\n+\tfor (int i=0; i<3; i++) {\n+\t\tlocalScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i];\n+\t\tlocalScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i];\n+\t\tlocalScaleVector[2][i] = _pose.z()[i] * aScaleFactors[i];\n+\t}\n+\tfor (int i=0; i<3; i++)\n+\t\t_dimensions[i] *= localScaleVector[i].norm();\n }\n \n //_____________________________________________________________________________\n@@ -174,10 +172,10 @@ void WrapEllipsoid::scale(const SimTK::Vec3& aScaleFactors)\n */\n void WrapEllipsoid::copyData(const WrapEllipsoid& aWrapEllipsoid)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapEllipsoid);\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapEllipsoid);\n \n-    _dimensions = aWrapEllipsoid._dimensions;\n+\t_dimensions = aWrapEllipsoid._dimensions;\n }\n \n //_____________________________________________________________________________\n@@ -188,7 +186,7 @@ void WrapEllipsoid::copyData(const WrapEllipsoid& aWrapEllipsoid)\n  */\n const char* WrapEllipsoid::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -201,10 +199,10 @@ const char* WrapEllipsoid::getWrapTypeName() const\n  */\n string WrapEllipsoid::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _dimensions[0] << " " << _dimensions[1] << " " << _dimensions[2];\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _dimensions[0] << " " << _dimensions[1] << " " << _dimensions[2];\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n \n //_____________________________________________________________________________\n@@ -215,7 +213,7 @@ string WrapEllipsoid::getDimensionsString() const\n  */\n SimTK::Vec3 WrapEllipsoid::getRadii() const\n {\n-    return SimTK::Vec3(_dimensions[0], _dimensions[1], _dimensions[2]);\n+\treturn SimTK::Vec3(_dimensions[0], _dimensions[1], _dimensions[2]);\n }\n \n //=============================================================================\n@@ -229,10 +227,10 @@ SimTK::Vec3 WrapEllipsoid::getRadii() const\n */\n WrapEllipsoid& WrapEllipsoid::operator=(const WrapEllipsoid& aWrapEllipsoid)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapEllipsoid);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapEllipsoid);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //=============================================================================\n@@ -250,412 +248,412 @@ WrapEllipsoid& WrapEllipsoid::operator=(const WrapEllipsoid& aWrapEllipsoid)\n  * @return The status, as a WrapAction enum\n  */\n int WrapEllipsoid::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                                     const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\t\t\t\t const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n-    int i, j, bestMu;\n-    SimTK::Vec3 p1, p2, m, a, p1p2, p1m, p2m, f1, f2, p1c1, r1r2, vs, t, mu;\n-    double ppm, aa, bb, cc, disc, l1, l2,\n-        p1e, p2e, vs4, dist, fanWeight = -SimTK::Infinity;\n-    double t_sv[3][3], t_c1[3][3];\n-    bool far_side_wrap = false;\n+\tint i, j, bestMu;\n+\tSimTK::Vec3 p1, p2, m, a, p1p2, p1m, p2m, f1, f2, p1c1, r1r2, vs, t, mu;\n+\tdouble ppm, aa, bb, cc, disc, l1, l2,\n+\t\tp1e, p2e, vs4, dist, fanWeight = -SimTK::Infinity;\n+\tdouble t_sv[3][3], t_c1[3][3];\n+\tbool far_side_wrap = false;\n    static SimTK::Vec3 origin(0,0,0);\n \n-    // In case you need any variables from the previous wrap, copy them from\n-    // the PathWrap into the WrapResult, re-normalizing the ones that were\n-    // un-normalized at the end of the previous wrap calculation.\n-    const WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n-    aWrapResult.factor = previousWrap.factor;\n-    for (i = 0; i < 3; i++)\n-    {\n-        aWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor;\n-        aWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor;\n-        aWrapResult.c1[i] = previousWrap.c1[i];\n-        aWrapResult.sv[i] = previousWrap.sv[i];\n-    }\n-\n-    aFlag = true;\n-    aWrapResult.wrap_pts.setSize(0);\n-\n-    // This algorithm works best if the coordinates (aPoint1, aPoint2,\n-    // origin, _dimensions) are all somewhat close to 1.0. So use\n-    // the ellipsoid dimensions to calculate a multiplication factor that\n-    // will be applied to all of the coordinates. You want to use just\n-    // the ellipsoid dimensions because they do not change from one call to the\n-    // next. You don\'t want the factor to change because the algorithm uses\n-    // some vectors (r1, r2, c1) from the previous call.\n-    aWrapResult.factor = 3.0 / (_dimensions[0] + _dimensions[1] + _dimensions[2]);\n-\n-    for (i = 0; i < 3; i++)\n-    {\n-        p1[i] = aPoint1[i] * aWrapResult.factor;\n-        p2[i] = aPoint2[i] * aWrapResult.factor;\n-        m[i]  = origin[i] * aWrapResult.factor;\n-        a[i]  = _dimensions[i] * aWrapResult.factor;\n-    }\n-\n-    p1e = -1.0;\n-    p2e = -1.0;\n-\n-    for (i = 0; i < 3;i++)\n-    {\n-        p1e += SQR((p1[i] - m[i]) / a[i]);\n-        p2e += SQR((p2[i] - m[i]) / a[i]);\n-    }\n-\n-    // check if p1 and p2 are inside the ellipsoid\n-    if (p1e < -0.0001 || p2e < -0.0001)\n-    {\n-        // p1 or p2 is inside the ellipsoid\n-        aFlag = false;\n-        aWrapResult.wrap_path_length = 0.0;\n-\n-        // transform back to starting coordinate system\n-        for (i = 0; i < 3; i++)\n-        {\n-            aWrapResult.r1[i] /= aWrapResult.factor;\n-            aWrapResult.r2[i] /= aWrapResult.factor;\n-        }\n-\n-        return insideRadius;\n-    }\n-\n-    MAKE_3DVECTOR21(p1, p2, p1p2);\n-    MAKE_3DVECTOR21(p1, m, p1m);\n-    Mtx::Normalize(3, p1m, p1m);\n-    MAKE_3DVECTOR21(p2, m, p2m);\n-    Mtx::Normalize(3, p2m, p2m);\n-\n-    ppm = Mtx::DotProduct(3, p1m, p2m) - 1.0;   // angle between p1->m and p2->m: -2.0 to 0.0\n-\n-    if (fabs(ppm) < 0.0001)\n-    {\n-        // vector p1m and p2m are colinear\n-        aFlag = false;\n-        aWrapResult.wrap_path_length = 0.0;\n-\n-        // transform back to starting coordinate system\n-        for (i = 0; i < 3; i++)\n-        {\n-            aWrapResult.r1[i] /= aWrapResult.factor;\n-            aWrapResult.r2[i] /= aWrapResult.factor;\n-        }\n-\n-        return noWrap;\n-    }\n-\n-    // check if the line through p1 and p2 intersects the ellipsoid\n-    for (i = 0; i < 3;i++)\n-    {\n-        f1[i] = p1p2[i] / a[i];\n-        f2[i] = (p2[i] - m[i]) / a[i];\n-    }\n-    aa = Mtx::DotProduct(3, f1, f1);\n-    bb = 2.0 * Mtx::DotProduct(3, f1, f2);\n-    cc = Mtx::DotProduct(3, f2, f2) - 1.0;\n-    disc = SQR(bb) - 4.0 * aa * cc;\n+\t// In case you need any variables from the previous wrap, copy them from\n+\t// the PathWrap into the WrapResult, re-normalizing the ones that were\n+\t// un-normalized at the end of the previous wrap calculation.\n+\tconst WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n+\taWrapResult.factor = previousWrap.factor;\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\taWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor;\n+\t\taWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor;\n+\t\taWrapResult.c1[i] = previousWrap.c1[i];\n+\t\taWrapResult.sv[i] = previousWrap.sv[i];\n+\t}\n+\n+\taFlag = true;\n+\taWrapResult.wrap_pts.setSize(0);\n+\n+\t// This algorithm works best if the coordinates (aPoint1, aPoint2,\n+\t// origin, _dimensions) are all somewhat close to 1.0. So use\n+\t// the ellipsoid dimensions to calculate a multiplication factor that\n+\t// will be applied to all of the coordinates. You want to use just\n+\t// the ellipsoid dimensions because they do not change from one call to the\n+\t// next. You don\'t want the factor to change because the algorithm uses\n+\t// some vectors (r1, r2, c1) from the previous call.\n+\taWrapResult.factor = 3.0 / (_dimensions[0] + _dimensions[1] + _dimensions[2]);\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tp1[i] = aPoint1[i] * aWrapResult.factor;\n+\t\tp2[i] = aPoint2[i] * aWrapResult.factor;\n+\t\tm[i]  = origin[i] * aWrapResult.factor;\n+\t\ta[i]  = _dimensions[i] * aWrapResult.factor;\n+\t}\n+\n+\tp1e = -1.0;\n+\tp2e = -1.0;\n+\n+\tfor (i = 0; i < 3;i++)\n+\t{\n+\t\tp1e += SQR((p1[i] - m[i]) / a[i]);\n+\t\tp2e += SQR((p2[i] - m[i]) / a[i]);\n+\t}\n+\n+\t// check if p1 and p2 are inside the ellipsoid\n+\tif (p1e < -0.0001 || p2e < -0.0001)\n+\t{\n+\t\t// p1 or p2 is inside the ellipsoid\n+\t\taFlag = false;\n+\t\taWrapResult.wrap_path_length = 0.0;\n+\n+\t\t// transform back to starting coordinate system\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t{\n+\t\t\taWrapResult.r1[i] /= aWrapResult.factor;\n+\t\t\taWrapResult.r2[i] /= aWrapResult.factor;\n+\t\t}\n+\n+\t\treturn insideRadius;\n+\t}\n+\n+\tMAKE_3DVECTOR21(p1, p2, p1p2);\n+\tMAKE_3DVECTOR21(p1, m, p1m);\n+\tMtx::Normalize(3, p1m, p1m);\n+\tMAKE_3DVECTOR21(p2, m, p2m);\n+\tMtx::Normalize(3, p2m, p2m);\n+\n+\tppm = Mtx::DotProduct(3, p1m, p2m) - 1.0;\t// angle between p1->m and p2->m: -2.0 to 0.0\n+\n+\tif (fabs(ppm) < 0.0001)\n+\t{\n+\t\t// vector p1m and p2m are colinear\n+\t\taFlag = false;\n+\t\taWrapResult.wrap_path_length = 0.0;\n+\n+\t\t// transform back to starting coordinate system\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t{\n+\t\t\taWrapResult.r1[i] /= aWrapResult.factor;\n+\t\t\taWrapResult.r2[i] /= aWrapResult.factor;\n+\t\t}\n+\n+\t\treturn noWrap;\n+\t}\n+\n+\t// check if the line through p1 and p2 intersects the ellipsoid\n+\tfor (i = 0; i < 3;i++)\n+\t{\n+\t\tf1[i] = p1p2[i] / a[i];\n+\t\tf2[i] = (p2[i] - m[i]) / a[i];\n+\t}\n+\taa = Mtx::DotProduct(3, f1, f1);\n+\tbb = 2.0 * Mtx::DotProduct(3, f1, f2);\n+\tcc = Mtx::DotProduct(3, f2, f2) - 1.0;\n+\tdisc = SQR(bb) - 4.0 * aa * cc;\n+\n+\tif (disc < 0.0)\n+\t{\n+\t\t// no intersection\n+\t\taFlag = false;\n+\t\taWrapResult.wrap_path_length = 0.0;\n+\n+\t\t// transform back to starting coordinate system\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t{\n+\t\t\taWrapResult.r1[i] /= aWrapResult.factor;\n+\t\t\taWrapResult.r2[i] /= aWrapResult.factor;\n+\t\t}\n+\n+\t\treturn noWrap;\n+\t}\n+\n+\tl1 = (-bb + sqrt(disc)) / (2.0 * aa);\n+\tl2 = (-bb - sqrt(disc)) / (2.0 * aa);\n+\n+\tif ( ! (0.0 < l1 && l1 < 1.0) || ! (0.0 < l2 && l2 < 1.0) )\n+\t{\n+\t\t// no intersection\n+\t\taFlag = false;\n+\t\taWrapResult.wrap_path_length = 0.0;\n+\n+\t\t// transform back to starting coordinate system\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t{\n+\t\t\taWrapResult.r1[i] /= aWrapResult.factor;\n+\t\t\taWrapResult.r2[i] /= aWrapResult.factor;\n+\t\t}\n+\n+\t\treturn noWrap;\n+\t}\n+\n+\t// r1 & r2: intersection points of p1->p2 with the ellipsoid\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\taWrapResult.r1[i] = p2[i] + l1 * p1p2[i];\n+\t\taWrapResult.r2[i] = p2[i] + l2 * p1p2[i];\n+\t}\n+\n+\t// ==== COMPUTE WRAPPING PLANE (begin) ====\n+\n+\tMAKE_3DVECTOR21(aWrapResult.r2, aWrapResult.r1, r1r2);\n+\n+\t// (1) Frans technique: choose the most parallel coordinate axis, then set\n+\t// \'sv\' to the point along the muscle line that crosses the plane where\n+\t// that major axis equals zero.  This takes advantage of the special-case\n+\t// handling in pt_to_ellipsoid() that reduces the 3d point-to-ellipsoid\n+\t// problem to a 2d point-to-ellipse problem.  The 2d case returns a nice\n+\t// c1 in situations where the "fan" has a sharp discontinuity.\n+\tMtx::Normalize(3, p1p2, mu);\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tmu[i] = fabs(mu[i]);\n+\n+\t\tt[i] = (m[i] - aWrapResult.r1[i]) / r1r2[i];\n+\n+\t\tfor (j = 0; j < 3; j++)\n+\t\t\tt_sv[i][j] = aWrapResult.r1[j] + t[i] * r1r2[j];\n+\n+\t\tfindClosestPoint(a[0], a[1], a[2], t_sv[i][0], t_sv[i][1], t_sv[i][2], &t_c1[i][0], &t_c1[i][1], &t_c1[i][2], i);\n+\t}\n+\n+\t// pick most parallel major axis\n+\tfor (bestMu = 0, i = 1; i < 3; i++)\n+\t\tif (mu[i] > mu[bestMu])\n+\t\t\tbestMu = i;\n+\n+\tif (aPathWrap.getMethod() == PathWrap::hybrid ||\n+\t\t aPathWrap.getMethod() == PathWrap::axial)\n+\t{\n+\t\tif (aPathWrap.getMethod() == PathWrap::hybrid && mu[bestMu] > MU_BLEND_MIN)\n+\t\t{\n+\t\t\t// If Frans\' technique produces an sv that is not within the r1->r2\n+\t\t\t// line segment, then that means that sv will be outside the ellipsoid.\n+\t\t\t// This can create an sv->c1 vector that points roughly 180-degrees\n+\t\t\t// opposite to the fan solution\'s sv->c1 vector.  This creates problems\n+\t\t\t// when interpolating between the Frans and fan solutions because the\n+\t\t\t// interpolated c1 can become colinear to the muscle line during\n+\t\t\t// interpolation.  Therefore we detect Frans-solution sv points near\n+\t\t\t// the ends of r1->r2 here, and fade out the Frans result for them.\n+\n+\t\t\tdouble s = 1.0;\n+\n+\t\t\tif (t[bestMu] < 0.0 || t[bestMu] > 1.0)\n+\t\t\t\ts = 0.0;\n+\n+\t\t\telse if (t[bestMu] < SV_BOUNDARY_BLEND)\n+\t\t\t\ts = t[bestMu] / SV_BOUNDARY_BLEND;\n+\n+\t\t\telse if (t[bestMu] > (1.0 - SV_BOUNDARY_BLEND))\n+\t\t\t\ts = (1.0 - t[bestMu]) / SV_BOUNDARY_BLEND;\n+\n+\t\t\tif (s < 1.0)\n+\t\t\t\tmu[bestMu] = MU_BLEND_MIN + s * (mu[bestMu] - MU_BLEND_MIN);\n+\t\t}\n+\n+\t\tif (aPathWrap.getMethod() == PathWrap::axial || mu[bestMu] > MU_BLEND_MIN)\n+\t\t{\n+\t\t\t// if the Frans solution produced a strong result, copy it into\n+\t\t\t// sv and c1.\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t{\n+\t\t\t\taWrapResult.c1[i] = t_c1[bestMu][i];\n+\t\t\t\taWrapResult.sv[i] = t_sv[bestMu][i];\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (aPathWrap.getMethod() == PathWrap::hybrid && mu[bestMu] < MU_BLEND_MAX)\n+\t\t{\n+\t\t\t// (2) Fan technique: sample the fan at fixed intervals and average the\n+\t\t\t// fan "blade" vectors together to determine c1.  This only works when\n+\t\t\t// the fan is smoothly continuous.  The sharper the discontinuity, the\n+\t\t\t// more jumpy c1 becomes.\n+\t\t\tSimTK::Vec3 v_sum(0,0,0);\n+\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tt_sv[2][i] = aWrapResult.r1[i] + 0.5 * r1r2[i];\n+\n+\t\t\tfor (i = 1; i < NUM_FAN_SAMPLES - 1; i++)\n+\t\t\t{\n+\t\t\t\tSimTK::Vec3 v;\n+\t\t\t\tdouble tt = (double) i / NUM_FAN_SAMPLES;\n+\n+\t\t\t\tfor (j = 0; j < 3; j++)\n+\t\t\t\t\tt_sv[0][j] = aWrapResult.r1[j] + tt * r1r2[j];\n+\n+\t\t\t\tfindClosestPoint(a[0], a[1], a[2], t_sv[0][0], t_sv[0][1], t_sv[0][2], &t_c1[0][0], &t_c1[0][1], &t_c1[0][2]);\n+\n+\t\t\t\tMAKE_3DVECTOR21(t_c1[0], t_sv[0], v);\n+\n+\t\t\t\tMtx::Normalize(3, v, v);\n+\n+\t\t\t\t// add sv->c1 "fan blade" vector to the running total\n+\t\t\t\tfor (j = 0; j < 3; j++)\n+\t\t\t\t\tv_sum[j] += v[j];\n \n-    if (disc < 0.0)\n-    {\n-        // no intersection\n-        aFlag = false;\n-        aWrapResult.wrap_path_length = 0.0;\n+\t\t\t}\n+\t\t\t// use vector sum to determine c1\n+\t\t\tMtx::Normalize(3, v_sum, v_sum);\n+\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tt_c1[0][i] = t_sv[2][i] + v_sum[i];\n+\n+\t\t\tif (mu[bestMu] <= MU_BLEND_MIN)\n+\t\t\t{\n+\t\t\t\tfindClosestPoint(a[0], a[1], a[2], t_c1[0][0], t_c1[0][1], t_c1[0][2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n \n-        // transform back to starting coordinate system\n-        for (i = 0; i < 3; i++)\n-        {\n-            aWrapResult.r1[i] /= aWrapResult.factor;\n-            aWrapResult.r2[i] /= aWrapResult.factor;\n-        }\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\taWrapResult.sv[i] = t_sv[2][i];\n \n-        return noWrap;\n-    }\n+\t\t\t\tfanWeight = 1.0;\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tdouble tt = (mu[bestMu] - MU_BLEND_MIN) / (MU_BLEND_MAX - MU_BLEND_MIN);\n \n-    l1 = (-bb + sqrt(disc)) / (2.0 * aa);\n-    l2 = (-bb - sqrt(disc)) / (2.0 * aa);\n+\t\t\t\tdouble oneMinusT = 1.0 - tt;\n \n-    if ( ! (0.0 < l1 && l1 < 1.0) || ! (0.0 < l2 && l2 < 1.0) )\n-    {\n-        // no intersection\n-        aFlag = false;\n-        aWrapResult.wrap_path_length = 0.0;\n+\t\t\t\tfindClosestPoint(a[0], a[1], a[2], t_c1[0][0], t_c1[0][1], t_c1[0][2], &t_c1[1][0], &t_c1[1][1], &t_c1[1][2]);\n \n-        // transform back to starting coordinate system\n-        for (i = 0; i < 3; i++)\n-        {\n-            aWrapResult.r1[i] /= aWrapResult.factor;\n-            aWrapResult.r2[i] /= aWrapResult.factor;\n-        }\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t{\n+\t\t\t\t\tt_c1[2][i] = tt * aWrapResult.c1[i] + oneMinusT * t_c1[1][i];\n \n-        return noWrap;\n-    }\n+\t\t\t\t\taWrapResult.sv[i] = tt * aWrapResult.sv[i] + oneMinusT * t_sv[2][i];\n+\t\t\t\t}\n+\t\t\t\tfindClosestPoint(a[0], a[1], a[2], t_c1[2][0], t_c1[2][1], t_c1[2][2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n \n-    // r1 & r2: intersection points of p1->p2 with the ellipsoid\n-    for (i = 0; i < 3; i++)\n-    {\n-        aWrapResult.r1[i] = p2[i] + l1 * p1p2[i];\n-        aWrapResult.r2[i] = p2[i] + l2 * p1p2[i];\n-    }\n+\t\t\t\tfanWeight = oneMinusT;\n+\t\t\t}\n+\t\t}\n+\t}\n+\telse // method == midpoint\n+\t{\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t\taWrapResult.sv[i] = aWrapResult.r1[i] + 0.5 * (aWrapResult.r2[i] - aWrapResult.r1[i]);\n \n-    // ==== COMPUTE WRAPPING PLANE (begin) ====\n+\t\tfindClosestPoint(a[0], a[1], a[2], aWrapResult.sv[0], aWrapResult.sv[1], aWrapResult.sv[2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n+\t}\n \n-    MAKE_3DVECTOR21(aWrapResult.r2, aWrapResult.r1, r1r2);\n+\t// ==== COMPUTE WRAPPING PLANE (end) ====\n \n-    // (1) Frans technique: choose the most parallel coordinate axis, then set\n-    // \'sv\' to the point along the muscle line that crosses the plane where\n-    // that major axis equals zero.  This takes advantage of the special-case\n-    // handling in pt_to_ellipsoid() that reduces the 3d point-to-ellipsoid\n-    // problem to a 2d point-to-ellipse problem.  The 2d case returns a nice\n-    // c1 in situations where the "fan" has a sharp discontinuity.\n-    Mtx::Normalize(3, p1p2, mu);\n+\t// The old way of initializing r1 used the intersection point\n+\t// of p1p2 and the ellipsoid. This caused the muscle path to\n+\t// "jump" to the other side of the ellipsoid as sv[] came near\n+\t// a plane of the ellipsoid. It jumped to the other side while\n+\t// c1[] was still on the first side. The new way of initializing\n+\t// r1 sets it to c1 so that it will stay on c1\'s side of the\n+\t// ellipsoid.\n+\t{\n+\t\tbool use_c1_to_find_tangent_pts = true;\n \n-    for (i = 0; i < 3; i++)\n-    {\n-        mu[i] = fabs(mu[i]);\n+\t\tif (aPathWrap.getMethod() == PathWrap::axial)\n+\t\t\tuse_c1_to_find_tangent_pts = (bool) (t[bestMu] > 0.0 && t[bestMu] < 1.0);\n \n-        t[i] = (m[i] - aWrapResult.r1[i]) / r1r2[i];\n+\t\tif (use_c1_to_find_tangent_pts)\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\taWrapResult.r1[i] = aWrapResult.r2[i] = aWrapResult.c1[i];\n+\t}\n \n-        for (j = 0; j < 3; j++)\n-            t_sv[i][j] = aWrapResult.r1[j] + t[i] * r1r2[j];\n+\t// if wrapping is constrained to one half of the ellipsoid,\n+\t// check to see if we need to flip c1 to the active side of\n+\t// the ellipsoid.\n+\tif (_wrapSign != 0)\n+\t{\n+\t\tdist = aWrapResult.c1[_wrapAxis] - m[_wrapAxis];\n \n-        findClosestPoint(a[0], a[1], a[2], t_sv[i][0], t_sv[i][1], t_sv[i][2], &t_c1[i][0], &t_c1[i][1], &t_c1[i][2], i);\n-    }\n+\t\tif (DSIGN(dist) != _wrapSign)\n+\t\t{\n+\t\t\tSimTK::Vec3 orig_c1=aWrapResult.c1;\n \n-    // pick most parallel major axis\n-    for (bestMu = 0, i = 1; i < 3; i++)\n-        if (mu[i] > mu[bestMu])\n-            bestMu = i;\n \n-    if (aPathWrap.getMethod() == PathWrap::hybrid ||\n-         aPathWrap.getMethod() == PathWrap::axial)\n-    {\n-        if (aPathWrap.getMethod() == PathWrap::hybrid && mu[bestMu] > MU_BLEND_MIN)\n-        {\n-            // If Frans\' technique produces an sv that is not within the r1->r2\n-            // line segment, then that means that sv will be outside the ellipsoid.\n-            // This can create an sv->c1 vector that points roughly 180-degrees\n-            // opposite to the fan solution\'s sv->c1 vector.  This creates problems\n-            // when interpolating between the Frans and fan solutions because the\n-            // interpolated c1 can become colinear to the muscle line during\n-            // interpolation.  Therefore we detect Frans-solution sv points near\n-            // the ends of r1->r2 here, and fade out the Frans result for them.\n+\t\t\taWrapResult.c1[_wrapAxis] = - aWrapResult.c1[_wrapAxis];\n \n-            double s = 1.0;\n+\t\t\taWrapResult.r1 = aWrapResult.r2 = aWrapResult.c1;\n \n-            if (t[bestMu] < 0.0 || t[bestMu] > 1.0)\n-                s = 0.0;\n+\t\t\tif (EQUAL_WITHIN_ERROR(fanWeight, -SimTK::Infinity))\n+\t\t\t\tfanWeight = 1.0 - (mu[bestMu] - MU_BLEND_MIN) / (MU_BLEND_MAX - MU_BLEND_MIN);\n \n-            else if (t[bestMu] < SV_BOUNDARY_BLEND)\n-                s = t[bestMu] / SV_BOUNDARY_BLEND;\n+\t\t\tif (fanWeight > 1.0)\n+\t\t\t\tfanWeight = 1.0;\n \n-            else if (t[bestMu] > (1.0 - SV_BOUNDARY_BLEND))\n-                s = (1.0 - t[bestMu]) / SV_BOUNDARY_BLEND;\n+\t\t\tif (fanWeight > 0.0)\n+\t\t\t{\n+\t\t\t\tSimTK::Vec3 tc1; \n+\t\t\t\tdouble bisection = (orig_c1[_wrapAxis] + aWrapResult.c1[_wrapAxis]) / 2.0;\n \n-            if (s < 1.0)\n-                mu[bestMu] = MU_BLEND_MIN + s * (mu[bestMu] - MU_BLEND_MIN);\n-        }\n+\t\t\t\taWrapResult.c1[_wrapAxis] = aWrapResult.c1[_wrapAxis] + fanWeight * (bisection - aWrapResult.c1[_wrapAxis]);\n \n-        if (aPathWrap.getMethod() == PathWrap::axial || mu[bestMu] > MU_BLEND_MIN)\n-        {\n-            // if the Frans solution produced a strong result, copy it into\n-            // sv and c1.\n-            for (i = 0; i < 3; i++)\n-            {\n-                aWrapResult.c1[i] = t_c1[bestMu][i];\n-                aWrapResult.sv[i] = t_sv[bestMu][i];\n-            }\n-        }\n+\t\t\t\ttc1 = aWrapResult.c1;\n \n-        if (aPathWrap.getMethod() == PathWrap::hybrid && mu[bestMu] < MU_BLEND_MAX)\n-        {\n-            // (2) Fan technique: sample the fan at fixed intervals and average the\n-            // fan "blade" vectors together to determine c1.  This only works when\n-            // the fan is smoothly continuous.  The sharper the discontinuity, the\n-            // more jumpy c1 becomes.\n-            SimTK::Vec3 v_sum(0,0,0);\n+\t\t\t\tfindClosestPoint(a[0], a[1], a[2], tc1[0], tc1[1], tc1[2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n+\t\t\t}\n+\t\t}\n+\t}\n \n-            for (i = 0; i < 3; i++)\n-                t_sv[2][i] = aWrapResult.r1[i] + 0.5 * r1r2[i];\n+\t// use p1, p2, and c1 to create parameters for the wrapping plane\n+\tMAKE_3DVECTOR21(p1, aWrapResult.c1, p1c1);\n+\tMtx::CrossProduct(p1p2, p1c1, vs);\n+\tMtx::Normalize(3, vs, vs);\n \n-            for (i = 1; i < NUM_FAN_SAMPLES - 1; i++)\n-            {\n-                SimTK::Vec3 v;\n-                double tt = (double) i / NUM_FAN_SAMPLES;\n+\tvs4 = - Mtx::DotProduct(3, vs, aWrapResult.c1);\n \n-                for (j = 0; j < 3; j++)\n-                    t_sv[0][j] = aWrapResult.r1[j] + tt * r1r2[j];\n+\t// find r1 & r2 by starting at c1 moving toward p1 & p2\n+\tcalcTangentPoint(p1e, aWrapResult.r1, p1, m, a, vs, vs4);\n+\tcalcTangentPoint(p2e, aWrapResult.r2, p2, m, a, vs, vs4);\n \n-                findClosestPoint(a[0], a[1], a[2], t_sv[0][0], t_sv[0][1], t_sv[0][2], &t_c1[0][0], &t_c1[0][1], &t_c1[0][2]);\n-\n-                MAKE_3DVECTOR21(t_c1[0], t_sv[0], v);\n-\n-                Mtx::Normalize(3, v, v);\n-\n-                // add sv->c1 "fan blade" vector to the running total\n-                for (j = 0; j < 3; j++)\n-                    v_sum[j] += v[j];\n-\n-            }\n-            // use vector sum to determine c1\n-            Mtx::Normalize(3, v_sum, v_sum);\n-\n-            for (i = 0; i < 3; i++)\n-                t_c1[0][i] = t_sv[2][i] + v_sum[i];\n-\n-            if (mu[bestMu] <= MU_BLEND_MIN)\n-            {\n-                findClosestPoint(a[0], a[1], a[2], t_c1[0][0], t_c1[0][1], t_c1[0][2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n-\n-                for (i = 0; i < 3; i++)\n-                    aWrapResult.sv[i] = t_sv[2][i];\n-\n-                fanWeight = 1.0;\n-            }\n-            else\n-            {\n-                double tt = (mu[bestMu] - MU_BLEND_MIN) / (MU_BLEND_MAX - MU_BLEND_MIN);\n-\n-                double oneMinusT = 1.0 - tt;\n-\n-                findClosestPoint(a[0], a[1], a[2], t_c1[0][0], t_c1[0][1], t_c1[0][2], &t_c1[1][0], &t_c1[1][1], &t_c1[1][2]);\n-\n-                for (i = 0; i < 3; i++)\n-                {\n-                    t_c1[2][i] = tt * aWrapResult.c1[i] + oneMinusT * t_c1[1][i];\n-\n-                    aWrapResult.sv[i] = tt * aWrapResult.sv[i] + oneMinusT * t_sv[2][i];\n-                }\n-                findClosestPoint(a[0], a[1], a[2], t_c1[2][0], t_c1[2][1], t_c1[2][2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n-\n-                fanWeight = oneMinusT;\n-            }\n-        }\n-    }\n-    else // method == midpoint\n-    {\n-        for (i = 0; i < 3; i++)\n-            aWrapResult.sv[i] = aWrapResult.r1[i] + 0.5 * (aWrapResult.r2[i] - aWrapResult.r1[i]);\n-\n-        findClosestPoint(a[0], a[1], a[2], aWrapResult.sv[0], aWrapResult.sv[1], aWrapResult.sv[2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n-    }\n-\n-    // ==== COMPUTE WRAPPING PLANE (end) ====\n-\n-    // The old way of initializing r1 used the intersection point\n-    // of p1p2 and the ellipsoid. This caused the muscle path to\n-    // "jump" to the other side of the ellipsoid as sv[] came near\n-    // a plane of the ellipsoid. It jumped to the other side while\n-    // c1[] was still on the first side. The new way of initializing\n-    // r1 sets it to c1 so that it will stay on c1\'s side of the\n-    // ellipsoid.\n-    {\n-        bool use_c1_to_find_tangent_pts = true;\n-\n-        if (aPathWrap.getMethod() == PathWrap::axial)\n-            use_c1_to_find_tangent_pts = (bool) (t[bestMu] > 0.0 && t[bestMu] < 1.0);\n-\n-        if (use_c1_to_find_tangent_pts)\n-            for (i = 0; i < 3; i++)\n-                aWrapResult.r1[i] = aWrapResult.r2[i] = aWrapResult.c1[i];\n-    }\n-\n-    // if wrapping is constrained to one half of the ellipsoid,\n-    // check to see if we need to flip c1 to the active side of\n-    // the ellipsoid.\n-    if (_wrapSign != 0)\n-    {\n-        dist = aWrapResult.c1[_wrapAxis] - m[_wrapAxis];\n-\n-        if (DSIGN(dist) != _wrapSign)\n-        {\n-            SimTK::Vec3 orig_c1=aWrapResult.c1;\n-\n-\n-            aWrapResult.c1[_wrapAxis] = - aWrapResult.c1[_wrapAxis];\n-\n-            aWrapResult.r1 = aWrapResult.r2 = aWrapResult.c1;\n-\n-            if (EQUAL_WITHIN_ERROR(fanWeight, -SimTK::Infinity))\n-                fanWeight = 1.0 - (mu[bestMu] - MU_BLEND_MIN) / (MU_BLEND_MAX - MU_BLEND_MIN);\n-\n-            if (fanWeight > 1.0)\n-                fanWeight = 1.0;\n-\n-            if (fanWeight > 0.0)\n-            {\n-                SimTK::Vec3 tc1; \n-                double bisection = (orig_c1[_wrapAxis] + aWrapResult.c1[_wrapAxis]) / 2.0;\n-\n-                aWrapResult.c1[_wrapAxis] = aWrapResult.c1[_wrapAxis] + fanWeight * (bisection - aWrapResult.c1[_wrapAxis]);\n-\n-                tc1 = aWrapResult.c1;\n-\n-                findClosestPoint(a[0], a[1], a[2], tc1[0], tc1[1], tc1[2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]);\n-            }\n-        }\n-    }\n-\n-    // use p1, p2, and c1 to create parameters for the wrapping plane\n-    MAKE_3DVECTOR21(p1, aWrapResult.c1, p1c1);\n-    Mtx::CrossProduct(p1p2, p1c1, vs);\n-    Mtx::Normalize(3, vs, vs);\n-\n-    vs4 = - Mtx::DotProduct(3, vs, aWrapResult.c1);\n-\n-    // find r1 & r2 by starting at c1 moving toward p1 & p2\n-    calcTangentPoint(p1e, aWrapResult.r1, p1, m, a, vs, vs4);\n-    calcTangentPoint(p2e, aWrapResult.r2, p2, m, a, vs, vs4);\n-\n-    // create a series of line segments connecting r1 & r2 along the\n-    // surface of the ellipsoid.\n+\t// create a series of line segments connecting r1 & r2 along the\n+\t// surface of the ellipsoid.\n \n calc_wrap_path:\n-    CalcDistanceOnEllipsoid(aWrapResult.r1, aWrapResult.r2, m, a, vs, vs4, far_side_wrap, aWrapResult);\n-\n-    if (_wrapSign != 0 && aWrapResult.wrap_pts.getSize() > 2 && ! far_side_wrap)\n-    {\n-        SimTK::Vec3 r1p1, r2p2, r1w1, r2w2;\n-\n-        SimTK::Vec3& w1 = aWrapResult.wrap_pts.updElt(1);\n-        SimTK::Vec3& w2 = aWrapResult.wrap_pts.updElt(aWrapResult.wrap_pts.getSize() - 2);\n-\n-        // check for wrong-way wrap by testing angle of first and last\n-        // wrap path segments:\n-        MAKE_3DVECTOR(aWrapResult.r1, p1, r1p1);\n-        MAKE_3DVECTOR(aWrapResult.r1, w1, r1w1);\n-        MAKE_3DVECTOR(aWrapResult.r2, p2, r2p2);\n-        MAKE_3DVECTOR(aWrapResult.r2, w2, r2w2);\n-\n-        Mtx::Normalize(3, r1p1, r1p1);\n-        Mtx::Normalize(3, r1w1, r1w1);\n-        Mtx::Normalize(3, r2p2, r2p2);\n-        Mtx::Normalize(3, r2w2, r2w2);\n-\n-        if (Mtx::DotProduct(3, r1p1, r1w1) > 0.0 || Mtx::DotProduct(3, r2p2, r2w2) > 0.0)\n-        {\n-            // NOTE: I added the ability to call CalcDistanceOnEllipsoid() a 2nd time in this\n-            //  situation to force a far-side wrap instead of aborting the\n-            //  wrap.   -- KMS 9/3/99\n-            far_side_wrap = true;\n-\n-            goto calc_wrap_path;\n-        }\n-    }\n-\n-    // unfactor the output coordinates\n-    aWrapResult.wrap_path_length /= aWrapResult.factor;\n-\n-    for (i = 0; i < aWrapResult.wrap_pts.getSize(); i++)\n-        aWrapResult.wrap_pts[i] *= (1.0 / aWrapResult.factor);\n-\n-    // transform back to starting coordinate system\n-    // Note: c1 and sv do not get transformed\n-    for (i = 0; i < 3; i++)\n-    {\n-        aWrapResult.r1[i] /= aWrapResult.factor;\n-        aWrapResult.r2[i] /= aWrapResult.factor;\n-    }\n-\n-    return mandatoryWrap;\n+\tCalcDistanceOnEllipsoid(aWrapResult.r1, aWrapResult.r2, m, a, vs, vs4, far_side_wrap, aWrapResult);\n+\n+\tif (_wrapSign != 0 && aWrapResult.wrap_pts.getSize() > 2 && ! far_side_wrap)\n+\t{\n+\t\tSimTK::Vec3 r1p1, r2p2, r1w1, r2w2;\n+\n+\t\tSimTK::Vec3& w1 = aWrapResult.wrap_pts.updElt(1);\n+\t\tSimTK::Vec3& w2 = aWrapResult.wrap_pts.updElt(aWrapResult.wrap_pts.getSize() - 2);\n+\n+\t\t// check for wrong-way wrap by testing angle of first and last\n+\t\t// wrap path segments:\n+\t\tMAKE_3DVECTOR(aWrapResult.r1, p1, r1p1);\n+\t\tMAKE_3DVECTOR(aWrapResult.r1, w1, r1w1);\n+\t\tMAKE_3DVECTOR(aWrapResult.r2, p2, r2p2);\n+\t\tMAKE_3DVECTOR(aWrapResult.r2, w2, r2w2);\n+\n+\t\tMtx::Normalize(3, r1p1, r1p1);\n+\t\tMtx::Normalize(3, r1w1, r1w1);\n+\t\tMtx::Normalize(3, r2p2, r2p2);\n+\t\tMtx::Normalize(3, r2w2, r2w2);\n+\n+\t\tif (Mtx::DotProduct(3, r1p1, r1w1) > 0.0 || Mtx::DotProduct(3, r2p2, r2w2) > 0.0)\n+\t\t{\n+\t\t\t// NOTE: I added the ability to call CalcDistanceOnEllipsoid() a 2nd time in this\n+\t\t\t//  situation to force a far-side wrap instead of aborting the\n+\t\t\t//  wrap.   -- KMS 9/3/99\n+\t\t\tfar_side_wrap = true;\n+\n+\t\t\tgoto calc_wrap_path;\n+\t\t}\n+\t}\n+\n+\t// unfactor the output coordinates\n+\taWrapResult.wrap_path_length /= aWrapResult.factor;\n+\n+\tfor (i = 0; i < aWrapResult.wrap_pts.getSize(); i++)\n+\t\taWrapResult.wrap_pts[i] *= (1.0 / aWrapResult.factor);\n+\n+\t// transform back to starting coordinate system\n+\t// Note: c1 and sv do not get transformed\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\taWrapResult.r1[i] /= aWrapResult.factor;\n+\t\taWrapResult.r2[i] /= aWrapResult.factor;\n+\t}\n+\n+\treturn mandatoryWrap;\n }\n \n //_____________________________________________________________________________\n@@ -675,188 +673,188 @@ calc_wrap_path:\n  * @return \'1\' if the point was adjusted, \'0\' otherwise\n  */\n int WrapEllipsoid::calcTangentPoint(double p1e, SimTK::Vec3& r1, SimTK::Vec3& p1, SimTK::Vec3& m,\n-                                                SimTK::Vec3& a, SimTK::Vec3& vs, double vs4) const\n+\t\t\t\t\t\t\t\t\t\t\t\tSimTK::Vec3& a, SimTK::Vec3& vs, double vs4) const\n {\n-    int i, j, k, nit, nit2, maxit=50, maxit2=1000;\n-    Vec3 nr1, p1r1, p1m;\n-    double d1, v[4], ee[4], ssqo, ssq, pcos, dedth[4][4];\n-    double fakt, alpha=0.01, dedth2[4][4], diag[4], ddinv2[4][4], vt[4], dd;\n+\tint i, j, k, nit, nit2, maxit=50, maxit2=1000;\n+\tVec3 nr1, p1r1, p1m;\n+\tdouble d1, v[4], ee[4], ssqo, ssq, pcos, dedth[4][4];\n+\tdouble fakt, alpha=0.01, dedth2[4][4], diag[4], ddinv2[4][4], vt[4], dd;\n \n-    if (fabs(p1e) < 0.0001)\n-    {\n-        for (i = 0; i < 3; i++)\n-            r1[i] = p1[i];\n-    }\n-    else\n-    {\n-        for (i = 0; i < 3; i++)\n-            nr1[i] = 2.0 * (r1[i] - m[i])/(SQR(a[i]));\n+\tif (fabs(p1e) < 0.0001)\n+\t{\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t\tr1[i] = p1[i];\n+\t}\n+\telse\n+\t{\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t\tnr1[i] = 2.0 * (r1[i] - m[i])/(SQR(a[i]));\n \n-        d1 = -Mtx::DotProduct(3, nr1, r1);\n-        ee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n-        ee[1] = -1.0;\n+\t\td1 = -Mtx::DotProduct(3, nr1, r1);\n+\t\tee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n+\t\tee[1] = -1.0;\n \n-        for (i = 0; i < 3; i++)\n-            ee[1] += SQR((r1[i] - m[i]) / a[i]);\n+\t\tfor (i = 0; i < 3; i++)\n+\t\t\tee[1] += SQR((r1[i] - m[i]) / a[i]);\n \n-        ee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n-        ee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n+\t\tee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n+\t\tee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n \n-        ssqo = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n-        ssq = ssqo;\n+\t\tssqo = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n+\t\tssq = ssqo;\n \n-        nit = 0;\n+\t\tnit = 0;\n \n-        while ((ssq > ELLIPSOID_TINY) && (nit < maxit))\n-        {\n-            nit++;\n+\t\twhile ((ssq > ELLIPSOID_TINY) && (nit < maxit))\n+\t\t{\n+\t\t\tnit++;\n \n-            for (i = 0; i < 3; i++)\n-            {\n-                dedth[i][0] = vs[i];\n-                dedth[i][1] = 2.0 * (r1[i] - m[i]) / SQR(a[i]);\n-                dedth[i][2] = 2.0 * (2.0 * r1[i] - m[i]) / SQR(a[i]);\n-                dedth[i][3] = 2.0 * p1[i] / SQR(a[i]);\n-            }\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t{\n+\t\t\t\tdedth[i][0] = vs[i];\n+\t\t\t\tdedth[i][1] = 2.0 * (r1[i] - m[i]) / SQR(a[i]);\n+\t\t\t\tdedth[i][2] = 2.0 * (2.0 * r1[i] - m[i]) / SQR(a[i]);\n+\t\t\t\tdedth[i][3] = 2.0 * p1[i] / SQR(a[i]);\n+\t\t\t}\n \n-            dedth[3][0] = 0.0;\n-            dedth[3][1] = 0.0;\n-            dedth[3][2] = 1.0;\n-            dedth[3][3] = 1.0;\n+\t\t\tdedth[3][0] = 0.0;\n+\t\t\tdedth[3][1] = 0.0;\n+\t\t\tdedth[3][2] = 1.0;\n+\t\t\tdedth[3][3] = 1.0;\n \n-            MAKE_3DVECTOR21(p1, r1, p1r1);\n-            Mtx::Normalize(3, p1r1, p1r1);\n+\t\t\tMAKE_3DVECTOR21(p1, r1, p1r1);\n+\t\t\tMtx::Normalize(3, p1r1, p1r1);\n \n-            MAKE_3DVECTOR21(p1, m, p1m);\n-            Mtx::Normalize(3, p1m, p1m);\n+\t\t\tMAKE_3DVECTOR21(p1, m, p1m);\n+\t\t\tMtx::Normalize(3, p1m, p1m);\n \n-            pcos = Mtx::DotProduct(3, p1r1, p1m);\n+\t\t\tpcos = Mtx::DotProduct(3, p1r1, p1m);\n \n-            if (pcos > 0.1)\n-                dd = 1.0 - pow(pcos, 100);\n-            else\n-                dd = 1.0;\n+\t\t\tif (pcos > 0.1)\n+\t\t\t\tdd = 1.0 - pow(pcos, 100);\n+\t\t\telse\n+\t\t\t\tdd = 1.0;\n \n-            for (i = 0; i < 4; i++)\n-            {\n-                v[i] = 0.0;\n+\t\t\tfor (i = 0; i < 4; i++)\n+\t\t\t{\n+\t\t\t\tv[i] = 0.0;\n \n-                for (j = 0; j < 4; j++)\n-                    v[i] -= dedth[i][j] * ee[j];\n-            }\n+\t\t\t\tfor (j = 0; j < 4; j++)\n+\t\t\t\t\tv[i] -= dedth[i][j] * ee[j];\n+\t\t\t}\n \n-            for (i = 0; i < 4; i++)\n-            {\n-                for (j = 0; j < 4; j++)\n-                {\n-                    dedth2[i][j] = 0.0;\n+\t\t\tfor (i = 0; i < 4; i++)\n+\t\t\t{\n+\t\t\t\tfor (j = 0; j < 4; j++)\n+\t\t\t\t{\n+\t\t\t\t\tdedth2[i][j] = 0.0;\n \n-                    for (k = 0; k < 4; k++)\n-                        dedth2[i][j] += dedth[i][k] * dedth[j][k];\n-                }\n-            }\n+\t\t\t\t\tfor (k = 0; k < 4; k++)\n+\t\t\t\t\t\tdedth2[i][j] += dedth[i][k] * dedth[j][k];\n+\t\t\t\t}\n+\t\t\t}\n \n-            for (i = 0; i < 4; i++)\n-                diag[i] = dedth2[i][i];\n+\t\t\tfor (i = 0; i < 4; i++)\n+\t\t\t\tdiag[i] = dedth2[i][i];\n \n-            nit2 = 0;\n+\t\t\tnit2 = 0;\n \n-            while ((ssq >= ssqo) && (nit2 < maxit2))\n-            {\n-                for (i = 0; i < 4; i++)\n-                    dedth2[i][i] = diag[i] * (1.0 + alpha);\n+\t\t\twhile ((ssq >= ssqo) && (nit2 < maxit2))\n+\t\t\t{\n+\t\t\t\tfor (i = 0; i < 4; i++)\n+\t\t\t\t\tdedth2[i][i] = diag[i] * (1.0 + alpha);\n \n-                Mtx::Invert(4, &dedth2[0][0], &ddinv2[0][0]);\n+\t\t\t\tMtx::Invert(4, &dedth2[0][0], &ddinv2[0][0]);\n \n-                for (i = 0; i < 4; i++)\n-                {\n-                    vt[i] = 0.0;\n+\t\t\t\tfor (i = 0; i < 4; i++)\n+\t\t\t\t{\n+\t\t\t\t\tvt[i] = 0.0;\n \n-                    for (j = 0; j < 4; j++)\n-                        vt[i] += dd * ddinv2[i][j] * v[j] / 16.0;\n-                }\n+\t\t\t\t\tfor (j = 0; j < 4; j++)\n+\t\t\t\t\t\tvt[i] += dd * ddinv2[i][j] * v[j] / 16.0;\n+\t\t\t\t}\n \n-                for (i = 0; i < 3; i++)\n-                    r1[i] += vt[i];\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\tr1[i] += vt[i];\n \n-                d1 += vt[3];\n+\t\t\t\td1 += vt[3];\n \n-                for (i = 0; i < 3; i++)\n-                    nr1[i] = 2.0 * (r1[i] - m[i])/SQR(a[i]);\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\tnr1[i] = 2.0 * (r1[i] - m[i])/SQR(a[i]);\n \n-                ee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n-                ee[1] = -1.0;\n+\t\t\t\tee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n+\t\t\t\tee[1] = -1.0;\n \n-                for (i = 0; i < 3; i++)\n-                    ee[1] += SQR((r1[i] - m[i])/a[i]);\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\tee[1] += SQR((r1[i] - m[i])/a[i]);\n \n-                ee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n-                ee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n+\t\t\t\tee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n+\t\t\t\tee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n \n-                ssqo = ssq;\n+\t\t\t\tssqo = ssq;\n \n-                ssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n+\t\t\t\tssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n \n-                alpha *= 4.0;\n-                nit2++;\n-            }\n+\t\t\t\talpha *= 4.0;\n+\t\t\t\tnit2++;\n+\t\t\t}\n \n-            alpha /= 8.0;\n+\t\t\talpha /= 8.0;\n \n-            fakt = 0.5;\n+\t\t\tfakt = 0.5;\n \n-            nit2 = 0;\n+\t\t\tnit2 = 0;\n \n-            while ((ssq <= ssqo) && (nit2 < maxit2))\n-            {\n-                fakt *= 2.0;\n+\t\t\twhile ((ssq <= ssqo) && (nit2 < maxit2))\n+\t\t\t{\n+\t\t\t\tfakt *= 2.0;\n \n-                for (i = 0; i < 3; i++)\n-                    r1[i] += vt[i] * fakt;\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\tr1[i] += vt[i] * fakt;\n \n-                d1 += vt[3] * fakt;\n+\t\t\t\td1 += vt[3] * fakt;\n \n-                for (i = 0; i < 3; i++)\n-                    nr1[i] = 2.0 * (r1[i] - m[i]) / SQR(a[i]);\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\tnr1[i] = 2.0 * (r1[i] - m[i]) / SQR(a[i]);\n \n-                ee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n-                ee[1] = -1.0;\n+\t\t\t\tee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n+\t\t\t\tee[1] = -1.0;\n \n-                for (i=0; i<3; i++)\n-                    ee[1] += SQR((r1[i] - m[i]) / a[i]);\n+\t\t\t\tfor (i=0; i<3; i++)\n+\t\t\t\t\tee[1] += SQR((r1[i] - m[i]) / a[i]);\n \n-                ee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n-                ee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n+\t\t\t\tee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n+\t\t\t\tee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n \n-                ssqo = ssq;     \n+\t\t\t\tssqo = ssq;\t    \n \n-                ssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n+\t\t\t\tssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n \n-                nit2++;\n-            }\n+\t\t\t\tnit2++;\n+\t\t\t}\n \n-            for (i = 0; i < 3; i++)\n-                r1[i] -= vt[i] * fakt;\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tr1[i] -= vt[i] * fakt;\n \n-            d1 -= vt[3] * fakt;\n+\t\t\td1 -= vt[3] * fakt;\n \n-            for (i=0; i<3; i++)\n-                nr1[i] = 2.0 * (r1[i] - m[i]) / SQR(a[i]);\n+\t\t\tfor (i=0; i<3; i++)\n+\t\t\t\tnr1[i] = 2.0 * (r1[i] - m[i]) / SQR(a[i]);\n \n-            ee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n-            ee[1] = -1.0;\n+\t\t\tee[0] = Mtx::DotProduct(3, vs, r1) + vs4;\n+\t\t\tee[1] = -1.0;\n \n-            for (i = 0; i < 3; i++)\n-                ee[1] += SQR((r1[i] - m[i]) / a[i]);\n+\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\tee[1] += SQR((r1[i] - m[i]) / a[i]);\n \n-            ee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n-            ee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n+\t\t\tee[2] = Mtx::DotProduct(3, nr1, r1) + d1;\n+\t\t\tee[3] = Mtx::DotProduct(3, nr1, p1) + d1;\n \n-            ssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n-            ssqo = ssq;     \n-        }\n-    }   \n-    return 1;\n+\t\t\tssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]);\n+\t\t\tssqo = ssq;\t    \n+\t\t}\n+\t}   \n+\treturn 1;\n \n }\n \n@@ -875,160 +873,160 @@ int WrapEllipsoid::calcTangentPoint(double p1e, SimTK::Vec3& r1, SimTK::Vec3& p1\n  * @param aWrapResult The wrapping results (tangent points, etc.)\n  */\n void WrapEllipsoid::CalcDistanceOnEllipsoid(SimTK::Vec3& r1, SimTK::Vec3& r2, SimTK::Vec3& m, SimTK::Vec3& a, \n-                                                          SimTK::Vec3& vs, double vs4, bool far_side_wrap,\n-                                                          WrapResult& aWrapResult) const\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t  SimTK::Vec3& vs, double vs4, bool far_side_wrap,\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WrapResult& aWrapResult) const\n {\n-    int i, j, k, l, imax, numPathSegments;\n-    SimTK::Vec3 u, ux, a0, ar1, ar2, vsy, vsz, t, r, f1, f2, dr, dv;\n-    double phi, dphi, phi0, len, mu, aa, bb, cc, mu3, s[500][3], r0[3][3], rphi[3][3], desiredSegLength = 0.001;\n-\n-    MAKE_3DVECTOR21(r1, r2, dr);\n-    len = Mtx::Magnitude(3, dr) / aWrapResult.factor;\n-\n-    if (len < desiredSegLength) {\n-        // If the distance between r1 and r2 is very small, then don\'t bother\n-        // calculating wrap points along the surface of the ellipsoid.\n-        // Just use r1 and r2 as the surface points and return the distance\n-        // between them as the distance along the ellipsoid.\n-        aWrapResult.wrap_pts.setSize(0);\n-        //SimmPoint p1(r1);\n-        aWrapResult.wrap_pts.append(r1);\n-        //SimmPoint p2(r2);\n-        aWrapResult.wrap_pts.append(r2);\n-        aWrapResult.wrap_path_length = len * aWrapResult.factor; // the length is unnormalized later\n-        return;\n-    } else {\n-        // You don\'t know the wrap length until you divide it\n-        // into N pieces and add up the lengths of each one.\n-        // So calculate N based on the distance between r1 and r2.\n-        // desiredSegLength should really depend on the units of\n-        // the model, but for now assume it\'s in meters and use 0.001.\n-        numPathSegments = (int) (len / desiredSegLength);\n-        if (numPathSegments <= 0)\n-        {\n-            aWrapResult.wrap_path_length = len;\n-            return;\n-        }\n-        else if (numPathSegments > 499)\n-            numPathSegments = 499;\n-    }\n-\n-    int numPathPts = numPathSegments + 1;\n-    int numInteriorPts = numPathPts - 2;\n-\n-    ux[0] = 1.0;\n-    ux[1] = 0.0;\n-    ux[2] = 0.0;\n-\n-    imax = 0;\n-\n-    for (i = 1; i < 3; i++)\n-        if (fabs(vs[i]) > fabs(vs[imax]))\n-            imax = i;\n-\n-    u[0] = u[1] = u[2] = 0.0;\n-    u[imax] = 1.0;\n-\n-    mu = (-Mtx::DotProduct(3, vs, m) - vs4) / Mtx::DotProduct(3, vs, u);\n-\n-    for (i=0;i<3;i++)\n-        a0[i] = m[i] + mu * u[i];\n-\n-    MAKE_3DVECTOR21(r1, a0, ar1);\n-    Mtx::Normalize(3, ar1, ar1);\n-    MAKE_3DVECTOR21(r2, a0, ar2);\n-    Mtx::Normalize(3, ar2, ar2);\n-\n-    phi0 = acos(Mtx::DotProduct(3, ar1, ar2));\n-\n-    if (far_side_wrap)\n-        dphi = - (2 * SimTK_PI - phi0) / (double) numPathSegments;\n-    else\n-        dphi = phi0 / (double) numPathSegments;\n-\n-    Mtx::CrossProduct(ar1, ar2, vsz);\n-    Mtx::Normalize(3, vsz, vsz);\n-    Mtx::CrossProduct(vsz, ar1, vsy);\n-\n-    for (i = 0; i < 3; i++)\n-    {\n-        for (j = 0; j < 3; j++)\n-        {\n-            rphi[i][j] = 0.0;\n-            r0[i][j] = 0.0;\n-        }\n-    }\n-\n-    for (i = 0; i < 3; i++)\n-    {\n-        r0[i][0] = ar1[i];\n-        r0[i][1] = vsy[i];\n-        r0[i][2] = vsz[i];\n-    }\n-\n-    rphi[2][2] = 1;\n-\n-    for (i = 0; i < numInteriorPts; i++)\n-    {\n-        phi = (i + 1) * dphi;\n-        rphi[0][0] = cos(phi);\n-        rphi[0][1] = -sin(phi);\n-        rphi[1][0] = sin(phi);\n-        rphi[1][1] = cos(phi);\n-\n-        for (j = 0; j < 3; j++)\n-        {\n-            r[j] = 0.0;\n-\n-            for (k = 0; k < 3; k++)\n-            {\n-                t[k] = 0.0;\n-\n-                for (l = 0; l < 3; l++)\n-                    t[k] += rphi[k][l] * ux[l];\n-\n-                r[j] += r0[j][k] * t[k];\n-            }\n-        }\n-\n-        for (j = 0; j < 3; j++)\n-        {\n-            f1[j] = r[j]/a[j];\n-            f2[j] = (a0[j] - m[j])/a[j];\n-        }\n-\n-        aa = Mtx::DotProduct(3, f1, f1);\n-        bb = 2.0 * (Mtx::DotProduct(3, f1, f2));\n-        cc = Mtx::DotProduct(3, f2, f2) - 1.0;\n-        mu3 = (-bb + sqrt(SQR(bb) - 4.0 * aa * cc)) / (2.0 * aa);\n-\n-        for (j = 0; j < 3; j++)\n-            s[i][j] = a0[j] + mu3 * r[j];\n-    }\n-\n-    aWrapResult.wrap_pts.setSize(0);\n-    //SimmPoint p1(r1);\n-    aWrapResult.wrap_pts.append(r1);\n-\n-    for (i = 0; i < numInteriorPts; i++)\n-    {\n-        Vec3 spt(Vec3::getAs(&s[i][0]));\n-        aWrapResult.wrap_pts.append(spt);\n-    }\n-\n-    //SimmPoint p2(r2);\n-    aWrapResult.wrap_pts.append(r2);\n-\n-    aWrapResult.wrap_path_length = 0.0;\n-\n-    for (i = 0; i < numPathSegments; i++)\n-    {\n-        Vec3 p = aWrapResult.wrap_pts.get(i);\n-        Vec3 q = aWrapResult.wrap_pts.get(i+1);\n-        MAKE_3DVECTOR21(q, p, dv); \n-\n-        aWrapResult.wrap_path_length += dv.norm(); //Mtx::Magnitude(3, dv);\n-    }\n+\tint i, j, k, l, imax, numPathSegments;\n+\tSimTK::Vec3 u, ux, a0, ar1, ar2, vsy, vsz, t, r, f1, f2, dr, dv;\n+\tdouble phi, dphi, phi0, len, mu, aa, bb, cc, mu3, s[500][3], r0[3][3], rphi[3][3], desiredSegLength = 0.001;\n+\n+\tMAKE_3DVECTOR21(r1, r2, dr);\n+\tlen = Mtx::Magnitude(3, dr) / aWrapResult.factor;\n+\n+\tif (len < desiredSegLength) {\n+\t\t// If the distance between r1 and r2 is very small, then don\'t bother\n+\t\t// calculating wrap points along the surface of the ellipsoid.\n+\t\t// Just use r1 and r2 as the surface points and return the distance\n+\t\t// between them as the distance along the ellipsoid.\n+\t\taWrapResult.wrap_pts.setSize(0);\n+\t\t//SimmPoint p1(r1);\n+\t\taWrapResult.wrap_pts.append(r1);\n+\t\t//SimmPoint p2(r2);\n+\t\taWrapResult.wrap_pts.append(r2);\n+\t\taWrapResult.wrap_path_length = len * aWrapResult.factor; // the length is unnormalized later\n+\t\treturn;\n+\t} else {\n+\t\t// You don\'t know the wrap length until you divide it\n+\t\t// into N pieces and add up the lengths of each one.\n+\t\t// So calculate N based on the distance between r1 and r2.\n+\t\t// desiredSegLength should really depend on the units of\n+\t\t// the model, but for now assume it\'s in meters and use 0.001.\n+\t\tnumPathSegments = (int) (len / desiredSegLength);\n+\t\tif (numPathSegments <= 0)\n+\t\t{\n+\t\t\taWrapResult.wrap_path_length = len;\n+\t\t\treturn;\n+\t\t}\n+\t\telse if (numPathSegments > 499)\n+\t\t\tnumPathSegments = 499;\n+\t}\n+\n+\tint numPathPts = numPathSegments + 1;\n+\tint numInteriorPts = numPathPts - 2;\n+\n+\tux[0] = 1.0;\n+\tux[1] = 0.0;\n+\tux[2] = 0.0;\n+\n+\timax = 0;\n+\n+\tfor (i = 1; i < 3; i++)\n+\t\tif (fabs(vs[i]) > fabs(vs[imax]))\n+\t\t\timax = i;\n+\n+\tu[0] = u[1] = u[2] = 0.0;\n+\tu[imax] = 1.0;\n+\n+\tmu = (-Mtx::DotProduct(3, vs, m) - vs4) / Mtx::DotProduct(3, vs, u);\n+\n+\tfor (i=0;i<3;i++)\n+\t\ta0[i] = m[i] + mu * u[i];\n+\n+\tMAKE_3DVECTOR21(r1, a0, ar1);\n+\tMtx::Normalize(3, ar1, ar1);\n+\tMAKE_3DVECTOR21(r2, a0, ar2);\n+\tMtx::Normalize(3, ar2, ar2);\n+\n+\tphi0 = acos(Mtx::DotProduct(3, ar1, ar2));\n+\n+\tif (far_side_wrap)\n+\t\tdphi = - (2 * SimTK_PI - phi0) / (double) numPathSegments;\n+\telse\n+\t\tdphi = phi0 / (double) numPathSegments;\n+\n+\tMtx::CrossProduct(ar1, ar2, vsz);\n+\tMtx::Normalize(3, vsz, vsz);\n+\tMtx::CrossProduct(vsz, ar1, vsy);\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tfor (j = 0; j < 3; j++)\n+\t\t{\n+\t\t\trphi[i][j] = 0.0;\n+\t\t\tr0[i][j] = 0.0;\n+\t\t}\n+\t}\n+\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\tr0[i][0] = ar1[i];\n+\t\tr0[i][1] = vsy[i];\n+\t\tr0[i][2] = vsz[i];\n+\t}\n+\n+\trphi[2][2] = 1;\n+\n+\tfor (i = 0; i < numInteriorPts; i++)\n+\t{\n+\t\tphi = (i + 1) * dphi;\n+\t\trphi[0][0] = cos(phi);\n+\t\trphi[0][1] = -sin(phi);\n+\t\trphi[1][0] = sin(phi);\n+\t\trphi[1][1] = cos(phi);\n+\n+\t\tfor (j = 0; j < 3; j++)\n+\t\t{\n+\t\t\tr[j] = 0.0;\n+\n+\t\t\tfor (k = 0; k < 3; k++)\n+\t\t\t{\n+\t\t\t\tt[k] = 0.0;\n+\n+\t\t\t\tfor (l = 0; l < 3; l++)\n+\t\t\t\t\tt[k] += rphi[k][l] * ux[l];\n+\n+\t\t\t\tr[j] += r0[j][k] * t[k];\n+\t\t\t}\n+\t\t}\n+\n+\t\tfor (j = 0; j < 3; j++)\n+\t\t{\n+\t\t\tf1[j] = r[j]/a[j];\n+\t\t\tf2[j] = (a0[j] - m[j])/a[j];\n+\t\t}\n+\n+\t\taa = Mtx::DotProduct(3, f1, f1);\n+\t\tbb = 2.0 * (Mtx::DotProduct(3, f1, f2));\n+\t\tcc = Mtx::DotProduct(3, f2, f2) - 1.0;\n+\t\tmu3 = (-bb + sqrt(SQR(bb) - 4.0 * aa * cc)) / (2.0 * aa);\n+\n+\t\tfor (j = 0; j < 3; j++)\n+\t\t\ts[i][j] = a0[j] + mu3 * r[j];\n+\t}\n+\n+\taWrapResult.wrap_pts.setSize(0);\n+\t//SimmPoint p1(r1);\n+\taWrapResult.wrap_pts.append(r1);\n+\n+\tfor (i = 0; i < numInteriorPts; i++)\n+\t{\n+\t\tVec3 spt(Vec3::getAs(&s[i][0]));\n+\t\taWrapResult.wrap_pts.append(spt);\n+\t}\n+\n+\t//SimmPoint p2(r2);\n+\taWrapResult.wrap_pts.append(r2);\n+\n+\taWrapResult.wrap_path_length = 0.0;\n+\n+\tfor (i = 0; i < numPathSegments; i++)\n+\t{\n+\t\tVec3 p = aWrapResult.wrap_pts.get(i);\n+\t\tVec3 q = aWrapResult.wrap_pts.get(i+1);\n+\t\tMAKE_3DVECTOR21(q, p, dv); \n+\n+\t\taWrapResult.wrap_path_length += dv.norm(); //Mtx::Magnitude(3, dv);\n+\t}\n }\n \n //_____________________________________________________________________________\n@@ -1054,9 +1052,9 @@ void WrapEllipsoid::CalcDistanceOnEllipsoid(SimTK::Vec3& r1, SimTK::Vec3& r2, Si\n  * @return The distance between the ellipsoid and the point in space\n  */\n double WrapEllipsoid::findClosestPoint(double a, double b, double c,\n-                                                    double u, double v, double w,\n-                                                    double* x, double* y, double* z,\n-                                                    int specialCaseAxis) const\n+\t\t\t\t\t\t\t\t\t\t\t\t\tdouble u, double v, double w,\n+\t\t\t\t\t\t\t\t\t\t\t\t\tdouble* x, double* y, double* z,\n+\t\t\t\t\t\t\t\t\t\t\t\t\tint specialCaseAxis) const\n {\n     // Graphics Gems IV algorithm for computing distance from point to\n     // ellipsoid (x/a)^2 + (y/b)^2 +(z/c)^2 = 1.  The algorithm as stated\n@@ -1071,7 +1069,7 @@ double WrapEllipsoid::findClosestPoint(double a, double b, double c,\n     // elliptical cross-section with the narrowest radius.\n     if (specialCaseAxis < 0)\n     {\n-         double uvw[3], minEllipseRadiiSum = SimTK::Infinity;\n+\t\t double uvw[3], minEllipseRadiiSum = SimTK::Infinity;\n        \n        uvw[0] = u; uvw[1] = v; uvw[2] = w;\n \n@@ -1188,112 +1186,112 @@ double WrapEllipsoid::findClosestPoint(double a, double b, double c,\n  * @return Distance between uv point and ellipse\n  */\n double WrapEllipsoid::closestPointToEllipse(double a, double b, double u,\n-                                                          double v, double* x, double* y) const\n+\t\t\t\t\t\t\t\t\t\t\t\t\t\t  double v, double* x, double* y) const\n {\n-    // Graphics Gems IV algorithm for computing distance from point to\n-    // ellipse (x/a)^2 + (y/b)^2 = 1.  The algorithm as stated is not stable\n-    // for points near the coordinate axes.  The first part of this code\n-    // handles those points separately.\n-    double a2 = a*a, b2 = b*b;\n-    double u2 = u*u, v2 = v*v;\n-    double a2u2 = a2*u2, b2v2 = b2*v2;\n-    double dx, dy, xda, ydb;\n-    int i, which;\n-    double t, P, Q, P2, Q2, f, fp;\n-\n-    bool nearXOrigin = (bool) EQUAL_WITHIN_ERROR(0.0,u);\n-    bool nearYOrigin = (bool) EQUAL_WITHIN_ERROR(0.0,v);\n-\n-    // handle points near the coordinate axes\n-    if (nearXOrigin && nearYOrigin)\n-    {\n-        if (a < b)\n-        {\n-            *x = (u < 0.0 ? -a : a);\n-            *y = v;\n-            return a;\n-        } else {\n-            *x = u;\n-            *y = (v < 0.0 ? -b : b);\n-            return b;\n-        }\n-    }\n-\n-    if (nearXOrigin)  // u == 0\n-    {\n-        if ( a >= b || fabs(v) >= b - a2/b )\n-        {\n-            *x = u;\n-            *y = ( v >= 0 ? b : -b );\n-            dy = *y - v;\n-            return fabs(dy);\n-        }\n-        else\n-        {\n-            *y = b2 * v / (b2-a2);\n-            dy = *y - v;\n-            ydb = *y / b;\n-            *x = a * sqrt(fabs(1 - ydb*ydb));\n-            return sqrt(*x * *x + dy*dy);\n-        }\n-    }\n-\n-    if (nearYOrigin)  // v == 0\n-    {\n-        if ( b >= a || fabs(u) >= a - b2/a )\n-        {\n-            *x = ( u >= 0 ? a : -a );\n-            dx = *x - u;\n-            *y = v;\n-            return fabs(*x - u);\n-        }\n-        else\n-        {\n-            *x = a2 * u / (a2-b2);\n-            dx = *x - u;\n-            xda = *x / a;\n-            *y = b * sqrt(fabs(1 - xda*xda));\n-            return sqrt(dx*dx + *y * *y);\n-        }\n-    }\n-\n-    // initial guess\n-    if ( (u/a)*(u/a) + (v/b)*(v/b) < 1.0 )\n-    {\n-        which = 0;\n-        t = 0.0;\n-    }\n-    else\n-    {\n-        double max = a;\n-\n-        which = 1;\n-\n-        if ( b > max )\n-            max = b;\n-\n-        t = max * sqrt(u*u + v*v);\n-    }\n-\n-    for (i = 0; i < 64; i++)\n-    {\n-        P = t+a2;\n-        P2 = P*P;\n-        Q = t+b2;\n-        Q2 = Q*Q;\n-        f = P2*Q2 - a2u2*Q2 - b2v2*P2;\n-\n-        if ( fabs(f) < 1e-09 )\n-            break;\n-\n-        fp = 2.0 * (P*Q*(P+Q) - a2u2*Q - b2v2*P);\n-        t -= f / fp;\n-    }\n-\n-    *x = a2 * u / P;\n-    *y = b2 * v / Q;\n-    dx = *x - u;\n-    dy = *y - v;\n-\n-    return sqrt(dx*dx + dy*dy);\n+\t// Graphics Gems IV algorithm for computing distance from point to\n+\t// ellipse (x/a)^2 + (y/b)^2 = 1.  The algorithm as stated is not stable\n+\t// for points near the coordinate axes.  The first part of this code\n+\t// handles those points separately.\n+\tdouble a2 = a*a, b2 = b*b;\n+\tdouble u2 = u*u, v2 = v*v;\n+\tdouble a2u2 = a2*u2, b2v2 = b2*v2;\n+\tdouble dx, dy, xda, ydb;\n+\tint i, which;\n+\tdouble t, P, Q, P2, Q2, f, fp;\n+\n+\tbool nearXOrigin = (bool) EQUAL_WITHIN_ERROR(0.0,u);\n+\tbool nearYOrigin = (bool) EQUAL_WITHIN_ERROR(0.0,v);\n+\n+\t// handle points near the coordinate axes\n+\tif (nearXOrigin && nearYOrigin)\n+\t{\n+\t\tif (a < b)\n+\t\t{\n+\t\t\t*x = (u < 0.0 ? -a : a);\n+\t\t\t*y = v;\n+\t\t\treturn a;\n+\t\t} else {\n+\t\t\t*x = u;\n+\t\t\t*y = (v < 0.0 ? -b : b);\n+\t\t\treturn b;\n+\t\t}\n+\t}\n+\n+\tif (nearXOrigin)  // u == 0\n+\t{\n+\t\tif ( a >= b || fabs(v) >= b - a2/b )\n+\t\t{\n+\t\t\t*x = u;\n+\t\t\t*y = ( v >= 0 ? b : -b );\n+\t\t\tdy = *y - v;\n+\t\t\treturn fabs(dy);\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\t*y = b2 * v / (b2-a2);\n+\t\t\tdy = *y - v;\n+\t\t\tydb = *y / b;\n+\t\t\t*x = a * sqrt(fabs(1 - ydb*ydb));\n+\t\t\treturn sqrt(*x * *x + dy*dy);\n+\t\t}\n+\t}\n+\n+\tif (nearYOrigin)  // v == 0\n+\t{\n+\t\tif ( b >= a || fabs(u) >= a - b2/a )\n+\t\t{\n+\t\t\t*x = ( u >= 0 ? a : -a );\n+\t\t\tdx = *x - u;\n+\t\t\t*y = v;\n+\t\t\treturn fabs(*x - u);\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\t*x = a2 * u / (a2-b2);\n+\t\t\tdx = *x - u;\n+\t\t\txda = *x / a;\n+\t\t\t*y = b * sqrt(fabs(1 - xda*xda));\n+\t\t\treturn sqrt(dx*dx + *y * *y);\n+\t\t}\n+\t}\n+\n+\t// initial guess\n+\tif ( (u/a)*(u/a) + (v/b)*(v/b) < 1.0 )\n+\t{\n+\t\twhich = 0;\n+\t\tt = 0.0;\n+\t}\n+\telse\n+\t{\n+\t\tdouble max = a;\n+\n+\t\twhich = 1;\n+\n+\t\tif ( b > max )\n+\t\t\tmax = b;\n+\n+\t\tt = max * sqrt(u*u + v*v);\n+\t}\n+\n+\tfor (i = 0; i < 64; i++)\n+\t{\n+\t\tP = t+a2;\n+\t\tP2 = P*P;\n+\t\tQ = t+b2;\n+\t\tQ2 = Q*Q;\n+\t\tf = P2*Q2 - a2u2*Q2 - b2v2*P2;\n+\n+\t\tif ( fabs(f) < 1e-09 )\n+\t\t\tbreak;\n+\n+\t\tfp = 2.0 * (P*Q*(P+Q) - a2u2*Q - b2v2*P);\n+\t\tt -= f / fp;\n+\t}\n+\n+\t*x = a2 * u / P;\n+\t*y = b2 * v / Q;\n+\tdx = *x - u;\n+\tdy = *y - v;\n+\n+\treturn sqrt(dx*dx + dy*dy);\n }\ndiff --git a/OpenSim/Simulation/Wrap/WrapEllipsoid.h b/OpenSim/Simulation/Wrap/WrapEllipsoid.h\nindex d70014fd2..4b53b664a 100644\n--- a/OpenSim/Simulation/Wrap/WrapEllipsoid.h\n+++ b/OpenSim/Simulation/Wrap/WrapEllipsoid.h\n@@ -29,7 +29,6 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDblArray.h>\n #include <OpenSim/Common/PropertyStr.h>\n #include "WrapObject.h"\n@@ -43,7 +42,6 @@\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathWrap;\ndiff --git a/OpenSim/Simulation/Wrap/WrapObject.cpp b/OpenSim/Simulation/Wrap/WrapObject.cpp\nindex d98f544d7..b9eb2ae19 100644\n--- a/OpenSim/Simulation/Wrap/WrapObject.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapObject.cpp\n@@ -31,7 +31,6 @@\n #include <OpenSim/Simulation/Model/PathPoint.h>\n #include "WrapResult.h"\n #include <OpenSim/Common/SimmMacros.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/Mtx.h>\n \n //=============================================================================\n@@ -49,17 +48,14 @@ using SimTK::Vec3;\n  * Default constructor.\n  */\n WrapObject::WrapObject() :\n-    Object(),\n+\tObject(),\n    _xyzBodyRotation(_xyzBodyRotationProp.getValueDblArray()),\n    _translation(_translationProp.getValueDblVec()),\n-    _active(_activeProp.getValueBool()),\n-    _quadrantName(_quadrantNameProp.getValueStr()),\n-    _displayerProp(PropertyObj("", VisibleObject())),\n-   _displayer((VisibleObject&)_displayerProp.getValueObj())\n-\n+\t_active(_activeProp.getValueBool()),\n+\t_quadrantName(_quadrantNameProp.getValueStr())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n     constructProperties();\n }\n \n@@ -78,18 +74,16 @@ WrapObject::~WrapObject()\n  * @param aWrapObject WrapObject to be copied.\n  */\n WrapObject::WrapObject(const WrapObject& aWrapObject) :\n-    Object(aWrapObject),\n+\tObject(aWrapObject),\n    _xyzBodyRotation(_xyzBodyRotationProp.getValueDblArray()),\n    _translation(_translationProp.getValueDblVec()),\n-    _active(_activeProp.getValueBool()),\n-    _quadrantName(_quadrantNameProp.getValueStr()),\n-    _displayerProp(PropertyObj("", VisibleObject())),\n-   _displayer((VisibleObject&)_displayerProp.getValueObj())\n+\t_active(_activeProp.getValueBool()),\n+\t_quadrantName(_quadrantNameProp.getValueStr())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n     //constructProperties();\n-    copyData(aWrapObject);\n+\tcopyData(aWrapObject);\n }\n \n //=============================================================================\n@@ -101,7 +95,7 @@ WrapObject::WrapObject(const WrapObject& aWrapObject) :\n  */\n void WrapObject::setNull()\n {\n-    _quadrant = allQuadrants;\n+\t_quadrant = allQuadrants;\n }\n \n //_____________________________________________________________________________\n@@ -110,35 +104,31 @@ void WrapObject::setNull()\n  */\n void WrapObject::setupProperties()\n {\n-    const double defaultRotations[] = {0.0, 0.0, 0.0};\n-    _xyzBodyRotationProp.setName("xyz_body_rotation");\n-    _xyzBodyRotationProp.setValue(3, defaultRotations);\n-    _propertySet.append(&_xyzBodyRotationProp);\n-\n-    const SimTK::Vec3 defaultTranslations(0.0);\n-    _translationProp.setName("translation");\n-    _translationProp.setValue(defaultTranslations);\n-    //_translationProp.setAllowableListSize(3);\n-    _propertySet.append(&_translationProp);\n-\n-    _activeProp.setName("active");\n-    _activeProp.setValue(true);\n-    _propertySet.append(&_activeProp);\n-\n-    _quadrantNameProp.setName("quadrant");\n-    _quadrantNameProp.setValue("Unassigned");\n-    _propertySet.append(&_quadrantNameProp);\n-\n-    _displayerProp.setName("display");\n-    _propertySet.append(&_displayerProp);\n-\n+\tconst double defaultRotations[] = {0.0, 0.0, 0.0};\n+\t_xyzBodyRotationProp.setName("xyz_body_rotation");\n+\t_xyzBodyRotationProp.setValue(3, defaultRotations);\n+\t_propertySet.append(&_xyzBodyRotationProp);\n+\n+\tconst SimTK::Vec3 defaultTranslations(0.0);\n+\t_translationProp.setName("translation");\n+\t_translationProp.setValue(defaultTranslations);\n+\t//_translationProp.setAllowableListSize(3);\n+\t_propertySet.append(&_translationProp);\n+\n+\t_activeProp.setName("active");\n+\t_activeProp.setValue(true);\n+\t_propertySet.append(&_activeProp);\n+\n+\t_quadrantNameProp.setName("quadrant");\n+\t_quadrantNameProp.setValue("Unassigned");\n+\t_propertySet.append(&_quadrantNameProp);\n }\n \n void WrapObject::constructProperties()\n {\n     constructProperty_display_preference(1);\n     Array<double> defaultColor(1.0, 3); //color default to 0, 1, 1\n-    defaultColor[0] = 0.0; \n+\tdefaultColor[0] = 0.0; \n \n     constructProperty_color(defaultColor);\n }\n@@ -148,16 +138,11 @@ void WrapObject::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n    _body = &aBody;\n    _model = &aModel;\n \n-    setupQuadrant();\n-\n-    SimTK::Rotation rot;\n-    rot.setRotationToBodyFixedXYZ(Vec3(_xyzBodyRotation[0], _xyzBodyRotation[1], _xyzBodyRotation[2]));\n-    _pose.set(rot, _translation);\n+\tsetupQuadrant();\n \n-    // Object is visible (has displayer) and depends on body it\'s attached to.\n-    _body->updDisplayer()->addDependent(updDisplayer());\n-    _displayer.setTransform(_pose);\n-    _displayer.setOwner(this);\n+\tSimTK::Rotation rot;\n+\trot.setRotationToBodyFixedXYZ(Vec3(_xyzBodyRotation[0], _xyzBodyRotation[1], _xyzBodyRotation[2]));\n+\t_pose.set(rot, _translation);\n }\n \n //_____________________________________________________________________________\n@@ -183,17 +168,17 @@ void WrapObject::scale(const SimTK::Vec3& aScaleFactors)\n  */\n void WrapObject::setGeometryQuadrants(OpenSim::AnalyticGeometry *aGeometry) const\n {\n-    // The following code should be moved to the base class WrapObject\n-    bool    quads[] = {true, true, true, true, true, true};\n-\n-    if (_quadrant != allQuadrants){\n-        // Turn off half wrap object\n-        if (_wrapSign==1)\n-            quads[2*_wrapAxis]=false;\n-        else\n-            quads[2*_wrapAxis+1]=false;\n-    }\n-    aGeometry->setQuadrants(quads);\n+\t// The following code should be moved to the base class WrapObject\n+\tbool\tquads[] = {true, true, true, true, true, true};\n+\n+\tif (_quadrant != allQuadrants){\n+\t\t// Turn off half wrap object\n+\t\tif (_wrapSign==1)\n+\t\t\tquads[2*_wrapAxis]=false;\n+\t\telse\n+\t\t\tquads[2*_wrapAxis+1]=false;\n+\t}\n+\taGeometry->setQuadrants(quads);\n }\n //_____________________________________________________________________________\n /**\n@@ -203,12 +188,11 @@ void WrapObject::setGeometryQuadrants(OpenSim::AnalyticGeometry *aGeometry) cons\n  */\n void WrapObject::copyData(const WrapObject& aWrapObject)\n {\n-    _xyzBodyRotation = aWrapObject._xyzBodyRotation;\n-    _translation = aWrapObject._translation;\n-    _active = aWrapObject._active;\n-    _quadrantName = aWrapObject._quadrantName;\n-    _quadrant = aWrapObject._quadrant;\n-    _displayer = aWrapObject._displayer;\n+\t_xyzBodyRotation = aWrapObject._xyzBodyRotation;\n+\t_translation = aWrapObject._translation;\n+\t_active = aWrapObject._active;\n+\t_quadrantName = aWrapObject._quadrantName;\n+\t_quadrant = aWrapObject._quadrant;\n }\n \n //_____________________________________________________________________________\n@@ -220,9 +204,9 @@ void WrapObject::copyData(const WrapObject& aWrapObject)\n  */\n void WrapObject::setQuadrantName(const string& aName)\n {\n-    _quadrantName = aName;\n+\t_quadrantName = aName;\n \n-    setupQuadrant();\n+\tsetupQuadrant();\n }\n \n //_____________________________________________________________________________\n@@ -233,41 +217,41 @@ void WrapObject::setQuadrantName(const string& aName)\n  */\n void WrapObject::setupQuadrant()\n {\n-    if (_quadrantName == "-x" || _quadrantName == "-X") {\n-        _quadrant = negativeX;\n-        _wrapAxis = 0;\n-        _wrapSign = -1;\n-    } else if (_quadrantName == "x" || _quadrantName == "+x" || _quadrantName == "X" || _quadrantName == "+X") {\n-        _quadrant = positiveX;\n-        _wrapAxis = 0;\n-        _wrapSign = 1;\n-    } else if (_quadrantName == "-y" || _quadrantName == "-Y") {\n-        _quadrant = negativeY;\n-        _wrapAxis = 1;\n-        _wrapSign = -1;\n-    } else if (_quadrantName == "y" || _quadrantName == "+y" || _quadrantName == "Y" || _quadrantName == "+Y") {\n-        _quadrant = positiveY;\n-        _wrapAxis = 1;\n-        _wrapSign = 1;\n-    } else if (_quadrantName == "-z" || _quadrantName == "-Z") {\n-        _quadrant = negativeZ;\n-        _wrapAxis = 2;\n-        _wrapSign = -1;\n-    } else if (_quadrantName == "z" || _quadrantName == "+z" || _quadrantName == "Z" || _quadrantName == "+Z") {\n-        _quadrant = positiveZ;\n-        _wrapAxis = 2;\n-        _wrapSign = 1;\n-    } else if (_quadrantName == "all" || _quadrantName == "ALL" || _quadrantName == "All") {\n-        _quadrant = allQuadrants;\n-        _wrapSign = 0;\n-    } else if (_quadrantName == "Unassigned") {  // quadrant was not specified in wrap object definition; use default\n-        _quadrant = allQuadrants;\n-        _quadrantName = "all";\n-        _wrapSign = 0;\n-    } else {  // quadrant was specified incorrectly in wrap object definition; throw an exception\n-        string errorMessage = "Error: quadrant for wrap object " + getName() + " was specified incorrectly.";\n-        throw Exception(errorMessage);\n-    }\n+\tif (_quadrantName == "-x" || _quadrantName == "-X") {\n+\t\t_quadrant = negativeX;\n+\t\t_wrapAxis = 0;\n+\t\t_wrapSign = -1;\n+\t} else if (_quadrantName == "x" || _quadrantName == "+x" || _quadrantName == "X" || _quadrantName == "+X") {\n+\t\t_quadrant = positiveX;\n+\t\t_wrapAxis = 0;\n+\t\t_wrapSign = 1;\n+\t} else if (_quadrantName == "-y" || _quadrantName == "-Y") {\n+\t\t_quadrant = negativeY;\n+\t\t_wrapAxis = 1;\n+\t\t_wrapSign = -1;\n+\t} else if (_quadrantName == "y" || _quadrantName == "+y" || _quadrantName == "Y" || _quadrantName == "+Y") {\n+\t\t_quadrant = positiveY;\n+\t\t_wrapAxis = 1;\n+\t\t_wrapSign = 1;\n+\t} else if (_quadrantName == "-z" || _quadrantName == "-Z") {\n+\t\t_quadrant = negativeZ;\n+\t\t_wrapAxis = 2;\n+\t\t_wrapSign = -1;\n+\t} else if (_quadrantName == "z" || _quadrantName == "+z" || _quadrantName == "Z" || _quadrantName == "+Z") {\n+\t\t_quadrant = positiveZ;\n+\t\t_wrapAxis = 2;\n+\t\t_wrapSign = 1;\n+\t} else if (_quadrantName == "all" || _quadrantName == "ALL" || _quadrantName == "All") {\n+\t\t_quadrant = allQuadrants;\n+\t\t_wrapSign = 0;\n+\t} else if (_quadrantName == "Unassigned") {  // quadrant was not specified in wrap object definition; use default\n+\t\t_quadrant = allQuadrants;\n+\t\t_quadrantName = "all";\n+\t\t_wrapSign = 0;\n+\t} else {  // quadrant was specified incorrectly in wrap object definition; throw an exception\n+\t\tstring errorMessage = "Error: quadrant for wrap object " + getName() + " was specified incorrectly.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n }\n \n //=============================================================================\n@@ -281,10 +265,10 @@ void WrapObject::setupQuadrant()\n  */\n WrapObject& WrapObject::operator=(const WrapObject& aWrapObject)\n {\n-    // BASE CLASS\n-    Object::operator=(aWrapObject);\n+\t// BASE CLASS\n+\tObject::operator=(aWrapObject);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //=============================================================================\n@@ -301,15 +285,15 @@ WrapObject& WrapObject::operator=(const WrapObject& aWrapObject)\n  * @return The status, as a WrapAction enum\n  */\n int WrapObject::wrapPathSegment(const SimTK::State& s, PathPoint& aPoint1, PathPoint& aPoint2,\n-                                          const PathWrap& aPathWrap, WrapResult& aWrapResult) const\n+\t\t\t\t\t\t\t\t\t\t  const PathWrap& aPathWrap, WrapResult& aWrapResult) const\n {\n    int return_code = noWrap;\n-    bool p_flag;\n-    Vec3 pt1(0.0);\n-    Vec3 pt2(0.0);\n+\tbool p_flag;\n+\tVec3 pt1(0.0);\n+\tVec3 pt2(0.0);\n \n-    // Convert the path points from the frames of the bodies they are attached\n-    // to to the frame of the wrap object\'s body\n+\t// Convert the path points from the frames of the bodies they are attached\n+\t// to to the frame of the wrap object\'s body\n     //_model->getSimbodyEngine().transformPosition(s, aPoint1.getBody(), aPoint1.getLocation(), getBody(), pt1);\n     pt1 = aPoint1.getBody()\n         .findLocationInAnotherFrame(s, aPoint1.getLocation(), getBody());\n@@ -318,23 +302,23 @@ int WrapObject::wrapPathSegment(const SimTK::State& s, PathPoint& aPoint1, PathP\n     pt2 = aPoint2.getBody()\n         .findLocationInAnotherFrame(s, aPoint2.getLocation(), getBody());\n \n-    // Convert the path points from the frame of the wrap object\'s body\n-    // into the frame of the wrap object\n-    pt1 = _pose.shiftBaseStationToFrame(pt1);\n-    pt2 = _pose.shiftBaseStationToFrame(pt2);\n+\t// Convert the path points from the frame of the wrap object\'s body\n+\t// into the frame of the wrap object\n+\tpt1 = _pose.shiftBaseStationToFrame(pt1);\n+\tpt2 = _pose.shiftBaseStationToFrame(pt2);\n \n-    return_code = wrapLine(s, pt1, pt2, aPathWrap, aWrapResult, p_flag);\n+\treturn_code = wrapLine(s, pt1, pt2, aPathWrap, aWrapResult, p_flag);\n \n    if (p_flag == true && return_code > 0) {\n-        // Convert the tangent points from the frame of the wrap object to the\n-        // frame of the wrap object\'s body\n-        aWrapResult.r1 = _pose.shiftFrameStationToBase(aWrapResult.r1);\n-        aWrapResult.r2 = _pose.shiftFrameStationToBase(aWrapResult.r2);\n-\n-        // Convert the surface points (between the tangent points) from the frame of\n-        // the wrap object to the frame of the wrap object\'s body\n-        for (int i = 0; i < aWrapResult.wrap_pts.getSize(); i++)\n-            aWrapResult.wrap_pts.updElt(i) = _pose.shiftFrameStationToBase(aWrapResult.wrap_pts.get(i));\n+\t\t// Convert the tangent points from the frame of the wrap object to the\n+\t\t// frame of the wrap object\'s body\n+\t\taWrapResult.r1 = _pose.shiftFrameStationToBase(aWrapResult.r1);\n+\t\taWrapResult.r2 = _pose.shiftFrameStationToBase(aWrapResult.r2);\n+\n+\t\t// Convert the surface points (between the tangent points) from the frame of\n+\t\t// the wrap object to the frame of the wrap object\'s body\n+\t\tfor (int i = 0; i < aWrapResult.wrap_pts.getSize(); i++)\n+\t\t\taWrapResult.wrap_pts.updElt(i) = _pose.shiftFrameStationToBase(aWrapResult.wrap_pts.get(i));\n    }\n \n    return return_code;\ndiff --git a/OpenSim/Simulation/Wrap/WrapObject.h b/OpenSim/Simulation/Wrap/WrapObject.h\nindex 09f148779..177f79ada 100644\n--- a/OpenSim/Simulation/Wrap/WrapObject.h\n+++ b/OpenSim/Simulation/Wrap/WrapObject.h\n@@ -25,6 +25,7 @@\n \n // INCLUDE\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n+#include <OpenSim/Common/Geometry.h>\n #include <OpenSim/Common/Object.h>\n #include <OpenSim/Common/PropertyObj.h>\n #include <OpenSim/Common/PropertyBool.h>\n@@ -32,15 +33,14 @@\n #include <OpenSim/Common/PropertyStr.h>\n \n #ifdef SWIG\n-    #ifdef OSIMSIMULATION_API\n-        #undef OSIMSIMULATION_API\n-        #define OSIMSIMULATION_API\n-    #endif\n+\t#ifdef OSIMSIMULATION_API\n+\t\t#undef OSIMSIMULATION_API\n+\t\t#define OSIMSIMULATION_API\n+\t#endif\n #endif\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class PathPoint;\n class PathWrap;\n@@ -65,58 +65,54 @@ OpenSim_DECLARE_ABSTRACT_OBJECT(WrapObject, Object);\n // DATA\n //=============================================================================\n public:\n-    enum WrapQuadrant\n-    {\n-        allQuadrants,\n-        negativeX,\n-        positiveX,\n-        negativeY,\n-        positiveY,\n-        negativeZ,\n-        positiveZ\n-    };\n-\n-    enum WrapAction\n-    {\n-        noWrap,          // the path segment did not intersect the wrap object\n-        insideRadius,    // one or both path points are inside the wrap object\n-        wrapped,         // successful wrap, but may not be \'best\' path\n-        mandatoryWrap    // successful wrap that must be used (e.g., both tangent\n-    };                  // points are on the constrained side of the wrap object)\n+\tenum WrapQuadrant\n+\t{\n+\t\tallQuadrants,\n+\t\tnegativeX,\n+\t\tpositiveX,\n+\t\tnegativeY,\n+\t\tpositiveY,\n+\t\tnegativeZ,\n+\t\tpositiveZ\n+\t};\n+\n+\tenum WrapAction\n+\t{\n+\t\tnoWrap,          // the path segment did not intersect the wrap object\n+\t\tinsideRadius,    // one or both path points are inside the wrap object\n+\t\twrapped,         // successful wrap, but may not be \'best\' path\n+\t\tmandatoryWrap    // successful wrap that must be used (e.g., both tangent\n+\t};                  // points are on the constrained side of the wrap object)\n \n protected:\n \n-    PropertyDblArray _xyzBodyRotationProp;\n-    Array<double>& _xyzBodyRotation;\n+\tPropertyDblArray _xyzBodyRotationProp;\n+\tArray<double>& _xyzBodyRotation;\n \n-    PropertyDblVec3 _translationProp;\n-    SimTK::Vec3 & _translation;\n+\tPropertyDblVec3 _translationProp;\n+\tSimTK::Vec3 & _translation;\n \n-    PropertyBool _activeProp;\n-    bool& _active;\n+\tPropertyBool _activeProp;\n+\tbool& _active;\n \n-    PropertyStr _quadrantNameProp;\n-    std::string& _quadrantName;\n+\tPropertyStr _quadrantNameProp;\n+\tstd::string& _quadrantName;\n \n-    // Support for Display\n-    PropertyObj _displayerProp;\n-    VisibleObject &_displayer;\n-\n-    WrapQuadrant _quadrant;\n-    int _wrapAxis;\n-    int _wrapSign;\n+\tWrapQuadrant _quadrant;\n+\tint _wrapAxis;\n+\tint _wrapSign;\n \n     SimTK::ReferencePtr<PhysicalFrame> _body;\n \n-    SimTK::Transform _pose;\n-    const Model* _model;\n+\tSimTK::Transform _pose;\n+\tconst Model* _model;\n \n //=============================================================================\n // METHODS\n //=============================================================================\n-    //--------------------------------------------------------------------------\n-    // CONSTRUCTION\n-    //--------------------------------------------------------------------------\n+\t//--------------------------------------------------------------------------\n+\t// CONSTRUCTION\n+\t//--------------------------------------------------------------------------\n public:\n     /** Display Preference to apply to the contact geometry.  **/\n     OpenSim_DECLARE_PROPERTY(display_preference, int,\n@@ -127,48 +123,45 @@ public:\n         "Display Color");\n \n     WrapObject();\n-    WrapObject(const WrapObject& aWrapObject);\n-    virtual ~WrapObject();\n+\tWrapObject(const WrapObject& aWrapObject);\n+\tvirtual ~WrapObject();\n \n #ifndef SWIG\n-    WrapObject& operator=(const WrapObject& aWrapObject);\n+\tWrapObject& operator=(const WrapObject& aWrapObject);\n #endif\n    void copyData(const WrapObject& aWrapObject);\n \n-    virtual void scale(const SimTK::Vec3& aScaleFactors);\n+\tvirtual void scale(const SimTK::Vec3& aScaleFactors);\n     virtual void connectToModelAndBody(Model& aModel, PhysicalFrame& aBody);\n \n     PhysicalFrame& getBody() const { return *_body; }\n-    const double* getXYZBodyRotation() const { return &_xyzBodyRotation[0]; }\n-    const double* getTranslation() const { return &_translation[0]; }\n-    bool getActive() const { return _active; }\n-    bool getActiveUseDefault() const { return _activeProp.getValueIsDefault(); }\n-    const char* getQuadrantName() const { return _quadrantName.c_str(); }\n-    bool getQuadrantNameUseDefault() const { return _quadrantNameProp.getValueIsDefault(); }\n-    void setQuadrantName(const std::string& aName);\n+\tconst double* getXYZBodyRotation() const { return &_xyzBodyRotation[0]; }\n+\tconst double* getTranslation() const { return &_translation[0]; }\n+\tbool getActive() const { return _active; }\n+\tbool getActiveUseDefault() const { return _activeProp.getValueIsDefault(); }\n+\tconst char* getQuadrantName() const { return _quadrantName.c_str(); }\n+\tbool getQuadrantNameUseDefault() const { return _quadrantNameProp.getValueIsDefault(); }\n+\tvoid setQuadrantName(const std::string& aName);\n         const SimTK::Transform& getTransform() const { return _pose; }\n-    virtual const char* getWrapTypeName() const = 0;\n-    virtual std::string getDimensionsString() const { return ""; } // TODO: total SIMM hack!\n+\tvirtual const char* getWrapTypeName() const = 0;\n+\tvirtual std::string getDimensionsString() const { return ""; } // TODO: total SIMM hack!\n #ifndef SWIG\n-    int wrapPathSegment( const SimTK::State& s, PathPoint& aPoint1, PathPoint& aPoint2,\n-        const PathWrap& aPathWrap, WrapResult& aWrapResult) const;\n-    virtual int wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-        const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const = 0;\n+\tint wrapPathSegment( const SimTK::State& s, PathPoint& aPoint1, PathPoint& aPoint2,\n+\t\tconst PathWrap& aPathWrap, WrapResult& aWrapResult) const;\n+\tvirtual int wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n+\t\tconst PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const = 0;\n #endif\n-    // Visible Object Support\n-    const VisibleObject* getDisplayer() const override { return &_displayer; }\n-    VisibleObject* updDisplayer() override { return &_displayer; }\n-    virtual void updateGeometry() {}\n+\tvirtual void updateGeometry() {};\n \n protected:\n-    void setupProperties();\n-    void setupQuadrant();\n-    void setGeometryQuadrants(AnalyticGeometry *aGeometry) const;\n+\tvoid setupProperties();\n+\tvoid setupQuadrant();\n+\tvoid setGeometryQuadrants(AnalyticGeometry *aGeometry) const;\n private:\n-    void setNull();\n+\tvoid setNull();\n     void constructProperties();\n //=============================================================================\n-};  // END of class WrapObject\n+};\t// END of class WrapObject\n //=============================================================================\n //=============================================================================\n \ndiff --git a/OpenSim/Simulation/Wrap/WrapSphere.cpp b/OpenSim/Simulation/Wrap/WrapSphere.cpp\nindex f1b474f9f..3c5553a00 100644\n--- a/OpenSim/Simulation/Wrap/WrapSphere.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapSphere.cpp\n@@ -49,11 +49,11 @@ static const char* wrapTypeName = "sphere";\n  * Default constructor.\n  */\n WrapSphere::WrapSphere() :\n-    WrapObject(),\n+\tWrapObject(),\n    _radius(_radiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -71,12 +71,12 @@ WrapSphere::~WrapSphere()\n  * @param aWrapSphere WrapSphere to be copied.\n  */\n WrapSphere::WrapSphere(const WrapSphere& aWrapSphere) :\n-    WrapObject(aWrapSphere),\n+\tWrapObject(aWrapSphere),\n    _radius(_radiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapSphere);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapSphere);\n }\n \n //=============================================================================\n@@ -96,12 +96,12 @@ void WrapSphere::setNull()\n  */\n void WrapSphere::setupProperties()\n {\n-    // BASE CLASS\n-    //WrapObject::setupProperties();\n+\t// BASE CLASS\n+\t//WrapObject::setupProperties();\n \n-    _radiusProp.setName("radius");\n-    _radiusProp.setValue(-1.0);\n-    _propertySet.append(&_radiusProp);\n+\t_radiusProp.setName("radius");\n+\t_radiusProp.setValue(-1.0);\n+\t_propertySet.append(&_radiusProp);\n }\n \n //_____________________________________________________________________________\n@@ -113,21 +113,19 @@ void WrapSphere::setupProperties()\n  */\n void WrapSphere::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n {\n-    // Base class\n-    Super::connectToModelAndBody(aModel, aBody);\n+\t// Base class\n+\tSuper::connectToModelAndBody(aModel, aBody);\n \n    // maybe set a parent pointer, _body = aBody;\n \n-    if (_radius < 0.0)\n-    {\n-        string errorMessage = "Error: radius for wrapSphere " + getName() + " was either not specified, or is negative.";\n-        throw Exception(errorMessage);\n-    }\n+\tif (_radius < 0.0)\n+\t{\n+\t\tstring errorMessage = "Error: radius for wrapSphere " + getName() + " was either not specified, or is negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n \n-    _displayer.freeGeometry();\n-    AnalyticSphere* sphere = new AnalyticSphere(_radius);\n-    setGeometryQuadrants(sphere);\n-    _displayer.addGeometry(sphere);\n+\tAnalyticSphere* sphere = new AnalyticSphere(_radius);\n+\tsetGeometryQuadrants(sphere);\n }\n \n //_____________________________________________________________________________\n@@ -152,10 +150,10 @@ void WrapSphere::scale(const SimTK::Vec3& aScaleFactors)\n  */\n void WrapSphere::copyData(const WrapSphere& aWrapSphere)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapSphere);\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapSphere);\n \n-    _radius = aWrapSphere._radius;\n+\t_radius = aWrapSphere._radius;\n }\n \n //_____________________________________________________________________________\n@@ -166,7 +164,7 @@ void WrapSphere::copyData(const WrapSphere& aWrapSphere)\n  */\n const char* WrapSphere::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -179,10 +177,10 @@ const char* WrapSphere::getWrapTypeName() const\n  */\n string WrapSphere::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _radius;\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _radius;\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n \n //_____________________________________________________________________________\n@@ -207,10 +205,10 @@ double WrapSphere::getRadius() const\n  */\n WrapSphere& WrapSphere::operator=(const WrapSphere& aWrapSphere)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapSphere);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapSphere);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //=============================================================================\n@@ -228,49 +226,49 @@ WrapSphere& WrapSphere::operator=(const WrapSphere& aWrapSphere)\n  * @return The status, as a WrapAction enum\n  */\n int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                                 const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\t\t\t const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n    double l1, l2, disc, a, b, c, a1, a2, j1, j2, j3, j4, r1r2, ra[3][3], rrx[3][3], aa[3][3], mat[4][4], \n-            axis[4], vec[4], rotvec[4], angle, *r11, *r22;\n-    Vec3 ri, p2m, p1m, mp, r1n, r2n,\n-            p1p2, np2, hp2, r1m, r2m, y, z, n, r1a, r2a,\n-            r1b, r2b, r1am, r2am, r1bm, r2bm;\n-            \n+\t\t\taxis[4], vec[4], rotvec[4], angle, *r11, *r22;\n+ \tVec3 ri, p2m, p1m, mp, r1n, r2n,\n+\t\t\tp1p2, np2, hp2, r1m, r2m, y, z, n, r1a, r2a,\n+\t\t\tr1b, r2b, r1am, r2am, r1bm, r2bm;\n+\t\t\t\n    int i, j, maxit, return_code = wrapped;\n    bool far_side_wrap = false;\n    static SimTK::Vec3 origin(0,0,0);\n \n-    // In case you need any variables from the previous wrap, copy them from\n-    // the PathWrap into the WrapResult, re-normalizing the ones that were\n-    // un-normalized at the end of the previous wrap calculation.\n-    const WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n-    aWrapResult.factor = previousWrap.factor;\n-    for (i = 0; i < 3; i++)\n-    {\n-        aWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor;\n-        aWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor;\n-        aWrapResult.c1[i] = previousWrap.c1[i];\n-        aWrapResult.sv[i] = previousWrap.sv[i];\n-    }\n+\t// In case you need any variables from the previous wrap, copy them from\n+\t// the PathWrap into the WrapResult, re-normalizing the ones that were\n+\t// un-normalized at the end of the previous wrap calculation.\n+\tconst WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n+\taWrapResult.factor = previousWrap.factor;\n+\tfor (i = 0; i < 3; i++)\n+\t{\n+\t\taWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor;\n+\t\taWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor;\n+\t\taWrapResult.c1[i] = previousWrap.c1[i];\n+\t\taWrapResult.sv[i] = previousWrap.sv[i];\n+\t}\n \n    maxit = 50;\n    aFlag = true;\n \n-    aWrapResult.wrap_pts.setSize(0);\n+\taWrapResult.wrap_pts.setSize(0);\n \n-    for (i = 0; i < 3; i++) {\n-        p1m[i] = aPoint1[i] - origin[i];\n-        p2m[i] = aPoint2[i] - origin[1];\n-        ri[i] = aPoint1[i] - aPoint2[i];\n-        mp[i] = origin[i] - aPoint2[i];\n-        p1p2[i] = aPoint1[i] - aPoint2[i];\n-    }\n+\tfor (i = 0; i < 3; i++) {\n+\t\tp1m[i] = aPoint1[i] - origin[i];\n+\t\tp2m[i] = aPoint2[i] - origin[1];\n+\t\tri[i] = aPoint1[i] - aPoint2[i];\n+\t\tmp[i] = origin[i] - aPoint2[i];\n+\t\tp1p2[i] = aPoint1[i] - aPoint2[i];\n+\t}\n \n    // check that neither point is inside the radius of the sphere\n-    if (Mtx::Magnitude(3, p1m) < _radius || Mtx::Magnitude(3, p2m) < _radius)\n+\tif (Mtx::Magnitude(3, p1m) < _radius || Mtx::Magnitude(3, p2m) < _radius)\n       return insideRadius;\n \n-    a = Mtx::DotProduct(3, ri, ri);\n+\ta = Mtx::DotProduct(3, ri, ri);\n    b = -2.0 * Mtx::DotProduct(3, mp, ri);\n    c = Mtx::DotProduct(3, mp, mp) - _radius * _radius;\n    disc = b * b - 4.0 * a * c;\n@@ -279,7 +277,7 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n    if (disc < 0.0) \n    {\n       aFlag = false;\n-        aWrapResult.wrap_path_length = 0.0;\n+\t\taWrapResult.wrap_path_length = 0.0;\n       return noWrap;\n    }\n \n@@ -287,7 +285,7 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n    l2 = (-b - sqrt(disc)) / (2.0 * a);\n \n    // check if the intersection is between p1 and p2\n-   if ( ! (0.0 < l1 && l1 < 1.0) || ! (0.0 < l2 && l2 < 1.0))   \n+   if ( ! (0.0 < l1 && l1 < 1.0) || ! (0.0 < l2 && l2 < 1.0))\t\n    {\n       aFlag = false;\n       aWrapResult.wrap_path_length = 0.0;\n@@ -301,22 +299,22 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n       return noWrap;\n    }\n \n-    Mtx::Normalize(3, p1p2, p1p2);\n-    Mtx::Normalize(3, p2m, np2);\n+\tMtx::Normalize(3, p1p2, p1p2);\n+\tMtx::Normalize(3, p2m, np2);\n \n-    Mtx::CrossProduct(p1p2, np2, hp2);\n+\tMtx::CrossProduct(p1p2, np2, hp2);\n \n    // if the muscle line passes too close to the center of the sphere\n    // then give up\n-    if (Mtx::Magnitude(3, hp2) < 0.00001) {\n-        // JPL 12/28/06: r1 and r2 from the previous wrap have already\n-        // been copied into aWrapResult (and not yet overwritten). So\n-        // just go directly to calc_path.\n+\tif (Mtx::Magnitude(3, hp2) < 0.00001) {\n+\t\t// JPL 12/28/06: r1 and r2 from the previous wrap have already\n+\t\t// been copied into aWrapResult (and not yet overwritten). So\n+\t\t// just go directly to calc_path.\n #if 0\n       // no wait!  don\'t give up!  Instead use the previous r1 & r2:\n       // -- added KMS 9/9/99\n       //\n-        const WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n+\t\tconst WrapResult& previousWrap = aPathWrap.getPreviousWrap();\n       for (i = 0; i < 3; i++) {\n          aWrapResult.r1[i] = previousWrap.r1[i];\n          aWrapResult.r2[i] = previousWrap.r2[i];\n@@ -326,11 +324,11 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n    }\n \n    // calc tangent point candidates r1a, r1b\n-    Mtx::Normalize(3, hp2, n);\n-    for (i = 0; i < 3; i++)\n-        y[i] = origin[i] - aPoint1[i];\n-    Mtx::Normalize(3, y, y);\n-    Mtx::CrossProduct(n, y, z);\n+\tMtx::Normalize(3, hp2, n);\n+\tfor (i = 0; i < 3; i++)\n+\t\ty[i] = origin[i] - aPoint1[i];\n+\tMtx::Normalize(3, y, y);\n+\tMtx::CrossProduct(n, y, z);\n    \n    for (i = 0; i < 3; i++)\n    {\n@@ -339,26 +337,26 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n       ra[i][2] = z[i];\n    }\n \n-    a1 = asin(_radius / Mtx::Magnitude(3, p1m));\n+\ta1 = asin(_radius / Mtx::Magnitude(3, p1m));\n \n-    WrapMath::Make3x3DirCosMatrix(a1, rrx);\n-    Mtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n-    // TODO: test that this gives same result as SIMM code\n+\tWrapMath::Make3x3DirCosMatrix(a1, rrx);\n+\tMtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n+\t// TODO: test that this gives same result as SIMM code\n \n    for (i = 0; i < 3; i++)\n       r1a[i] = aPoint1[i] + aa[i][1] * Mtx::Magnitude(3, p1m) * cos(a1);\n \n    WrapMath::Make3x3DirCosMatrix(-a1, rrx);\n-    Mtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n+\tMtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n \n    for (i = 0; i < 3; i++)\n       r1b[i] = aPoint1[i] + aa[i][1] * Mtx::Magnitude(3, p1m) * cos(a1);\n \n    // calc tangent point candidates r2a, r2b\n-    for (i = 0; i < 3; i++)\n-        y[i] = origin[i] - aPoint2[i];\n-    Mtx::Normalize(3, y, y);\n-    Mtx::CrossProduct(n, y, z);\n+\tfor (i = 0; i < 3; i++)\n+\t\ty[i] = origin[i] - aPoint2[i];\n+\tMtx::Normalize(3, y, y);\n+\tMtx::CrossProduct(n, y, z);\n \n    for (i = 0; i < 3; i++)\n    {\n@@ -370,70 +368,70 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n    a2 = asin(_radius / Mtx::Magnitude(3, p2m));\n    \n    WrapMath::Make3x3DirCosMatrix(a2, rrx);\n-    Mtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n+\tMtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n \n    for (i = 0; i < 3; i++)\n       r2a[i] = aPoint2[i] + aa[i][1] * Mtx::Magnitude(3, p2m) * cos(a2);\n \n    WrapMath::Make3x3DirCosMatrix(-a2, rrx);\n-    Mtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n+\tMtx::Multiply(3, 3, 3, (double*)ra, (double*)rrx, (double*)aa);\n \n    for (i = 0; i < 3; i++)\n       r2b[i] = aPoint2[i] + aa[i][1] * Mtx::Magnitude(3, p2m) * cos(a2);\n \n    // determine wrapping tangent points r1 & r2\n-    for (i = 0; i < 3; i++) {\n-        r1am[i] = r1a[i] - origin[i];\n-        r1bm[i] = r1b[i] - origin[i];\n-        r2am[i] = r2a[i] - origin[i];\n-        r2bm[i] = r2b[i] - origin[i];\n-    }\n-\n-    Mtx::Normalize(3, r1am, r1am);\n-    Mtx::Normalize(3, r1bm, r1bm);\n-    Mtx::Normalize(3, r2am, r2am);\n-    Mtx::Normalize(3, r2bm, r2bm);\n+\tfor (i = 0; i < 3; i++) {\n+\t\tr1am[i] = r1a[i] - origin[i];\n+\t\tr1bm[i] = r1b[i] - origin[i];\n+\t\tr2am[i] = r2a[i] - origin[i];\n+\t\tr2bm[i] = r2b[i] - origin[i];\n+\t}\n+\n+\tMtx::Normalize(3, r1am, r1am);\n+\tMtx::Normalize(3, r1bm, r1bm);\n+\tMtx::Normalize(3, r2am, r2am);\n+\tMtx::Normalize(3, r2bm, r2bm);\n    \n    {\n       // check which of the tangential points results in the shortest distance\n-        j1 = Mtx::DotProduct(3, r1am, r2am);\n+\t\tj1 = Mtx::DotProduct(3, r1am, r2am);\n       j2 = Mtx::DotProduct(3, r1am, r2bm);\n       j3 = Mtx::DotProduct(3, r1bm, r2am);\n       j4 = Mtx::DotProduct(3, r1bm, r2bm);\n        \n       if (j1 > j2 && j1 > j3 && j1 > j4)\n       {\n-            for (i = 0; i < 3; i++) {\n-                aWrapResult.r1[i] = r1a[i];\n-                aWrapResult.r2[i] = r2a[i];\n-            }\n+\t\t\tfor (i = 0; i < 3; i++) {\n+\t\t\t\taWrapResult.r1[i] = r1a[i];\n+\t\t\t\taWrapResult.r2[i] = r2a[i];\n+\t\t\t}\n          r11 = &r1b[0];\n          r22 = &r2b[0];\n       }\n       else if (j2 > j3 && j2 > j4)\n       {\n-            for (i = 0; i < 3; i++) {\n-                aWrapResult.r1[i] = r1a[i];\n-                aWrapResult.r2[i] = r2b[i];\n-            }\n+\t\t\tfor (i = 0; i < 3; i++) {\n+\t\t\t\taWrapResult.r1[i] = r1a[i];\n+\t\t\t\taWrapResult.r2[i] = r2b[i];\n+\t\t\t}\n          r11 = &r1b[0];\n          r22 = &r2a[0];\n       }\n       else if (j3 > j4)\n       {\n-            for (i = 0; i < 3; i++) {\n-                aWrapResult.r1[i] = r1b[i];\n-                aWrapResult.r2[i] = r2a[i];\n-            }\n+\t\t\tfor (i = 0; i < 3; i++) {\n+\t\t\t\taWrapResult.r1[i] = r1b[i];\n+\t\t\t\taWrapResult.r2[i] = r2a[i];\n+\t\t\t}\n          r11 = &r1a[0];\n          r22 = &r2b[0];\n       }\n       else\n       {\n-            for (i = 0; i < 3; i++) {\n-                aWrapResult.r1[i] = r1b[i];\n-                aWrapResult.r2[i] = r2b[i];\n-            }\n+\t\t\tfor (i = 0; i < 3; i++) {\n+\t\t\t\taWrapResult.r1[i] = r1b[i];\n+\t\t\t\taWrapResult.r2[i] = r2b[i];\n+\t\t\t}\n          r11 = &r1a[0];\n          r22 = &r2a[0];\n       }\n@@ -444,7 +442,7 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n       if (DSIGN(aPoint1[_wrapAxis]) == _wrapSign || DSIGN(aPoint2[_wrapAxis]) == _wrapSign)\n       {\n          double tt, r_squared = _radius * _radius;\n-            Vec3 mm;\n+\t\t\tVec3 mm;\n          // If either muscle point is on the constrained side, then check for intersection\n          // of the muscle line and the cylinder. If there is an intersection, then\n          // you\'ve found a mandatory wrap. If not, then if one point is not on the constrained\n@@ -482,31 +480,31 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n          for (i = 0; i < 3; i++)\n             sum_musc[i] = (origin[i] - aPoint1[i]) + (origin[i] - aPoint2[i]);\n \n-            Mtx::Normalize(3, sum_musc, sum_musc);\n+\t\t\tMtx::Normalize(3, sum_musc, sum_musc);\n \n-            if (Mtx::DotProduct(3, r1am, sum_musc) > Mtx::DotProduct(3, r1bm, sum_musc))\n+\t\t\tif (Mtx::DotProduct(3, r1am, sum_musc) > Mtx::DotProduct(3, r1bm, sum_musc))\n          {\n-                for (i = 0; i < 3; i++)\n-                    aWrapResult.r1[i] = r1a[i];\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\taWrapResult.r1[i] = r1a[i];\n             r11 = &r1b[0];\n          }\n          else\n          {\n-                for (i = 0; i < 3; i++)\n-                    aWrapResult.r1[i] = r1b[i];\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\taWrapResult.r1[i] = r1b[i];\n             r11 = &r1a[0];\n          }\n \n-            if (Mtx::DotProduct(3, r2am, sum_musc) > Mtx::DotProduct(3, r2bm, sum_musc))\n+\t\t\tif (Mtx::DotProduct(3, r2am, sum_musc) > Mtx::DotProduct(3, r2bm, sum_musc))\n          {\n-                for (i = 0; i < 3; i++)\n-                    aWrapResult.r2[i] = r2a[i];\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\taWrapResult.r2[i] = r2a[i];\n             r22 = &r2b[0];\n          }\n          else\n          {\n-                for (i = 0; i < 3; i++)\n-                    aWrapResult.r2[i] = r2b[i];\n+\t\t\t\tfor (i = 0; i < 3; i++)\n+\t\t\t\t\taWrapResult.r2[i] = r2b[i];\n             r22 = &r2a[0];\n          }\n \n@@ -514,14 +512,14 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n          for (i = 0; i < 3; i++)\n             sum_musc[i] = (aWrapResult.r1[i] - aPoint1[i]) + (aWrapResult.r2[i] - aPoint2[i]);\n \n-            Mtx::Normalize(3, sum_musc, sum_musc);\n+\t\t\tMtx::Normalize(3, sum_musc, sum_musc);\n \n-            if (Mtx::DotProduct(3, sum_musc, wrapaxis) < 0.0)\n+\t\t\tif (Mtx::DotProduct(3, sum_musc, wrapaxis) < 0.0)\n          {\n-                for (i = 0; i < 3; i++) {\n-                    aWrapResult.r1[i] = r11[i];\n-                    aWrapResult.r2[i] = r22[i];\n-                }\n+\t\t\t\tfor (i = 0; i < 3; i++) {\n+\t\t\t\t\taWrapResult.r1[i] = r11[i];\n+\t\t\t\t\taWrapResult.r2[i] = r22[i];\n+\t\t\t\t}\n          }\n \n          // determine if the resulting tangent points create a far side wrap\n@@ -530,45 +528,45 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n             sum_r[i] = (aWrapResult.r1[i] - origin[i]) + (aWrapResult.r2[i] - origin[i]);\n          }\n \n-            if (Mtx::DotProduct(3, sum_r, sum_musc) < 0.0)\n+\t\t\tif (Mtx::DotProduct(3, sum_r, sum_musc) < 0.0)\n             far_side_wrap = true;\n       }\n    }\n \n  calc_path:\n-    for (i = 0; i < 3; i++) {\n-        r1m[i] = aWrapResult.r1[i] - origin[i];\n-        r2m[i] = aWrapResult.r2[i] - origin[i];\n-    }\n+\tfor (i = 0; i < 3; i++) {\n+\t\tr1m[i] = aWrapResult.r1[i] - origin[i];\n+\t\tr2m[i] = aWrapResult.r2[i] - origin[i];\n+\t}\n \n-    Mtx::Normalize(3, r1m, r1n);\n-    Mtx::Normalize(3, r2m, r2n);\n+\tMtx::Normalize(3, r1m, r1n);\n+\tMtx::Normalize(3, r2m, r2n);\n \n-    angle = acos(Mtx::DotProduct(3, r1n, r2n));\n+\tangle = acos(Mtx::DotProduct(3, r1n, r2n));\n    \n    if (far_side_wrap)\n-        angle = -(2 * SimTK_PI - angle);\n+\t\tangle = -(2 * SimTK_PI - angle);\n    \n    r1r2 = _radius * angle;\n    aWrapResult.wrap_path_length = r1r2;\n \n-    Vec3 axis3;\n-    Mtx::CrossProduct(r1n, r2n, axis3);\n-    Mtx::Normalize(3, axis3, axis3);\n+\tVec3 axis3;\n+\tMtx::CrossProduct(r1n, r2n, axis3);\n+\tMtx::Normalize(3, axis3, axis3);\n \n    for(int ii=0; ii<3; ii++) axis[ii]=axis3[ii];\n    axis[3] = 1.0;\n \n-    aWrapResult.wrap_pts.setSize(0);\n+\taWrapResult.wrap_pts.setSize(0);\n \n-    // Each muscle segment on the surface of the sphere should be\n-    // 0.002 meters long. This assumes the model is in meters, of course.\n-    int numWrapSegments = (int) (aWrapResult.wrap_path_length / 0.002);\n-    if (numWrapSegments < 1)\n-        numWrapSegments = 1;\n+\t// Each muscle segment on the surface of the sphere should be\n+\t// 0.002 meters long. This assumes the model is in meters, of course.\n+\tint numWrapSegments = (int) (aWrapResult.wrap_path_length / 0.002);\n+\tif (numWrapSegments < 1)\n+\t\tnumWrapSegments = 1;\n \n-    //SimmPoint sp1(aWrapResult.r1);\n-    aWrapResult.wrap_pts.append(aWrapResult.r1);\n+\t//SimmPoint sp1(aWrapResult.r1);\n+\taWrapResult.wrap_pts.append(aWrapResult.r1);\n \n    vec[0] = r1m[0];\n    vec[1] = r1m[1];\n@@ -576,20 +574,20 @@ int WrapSphere::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec\n    vec[3] = 1.0;\n \n    for (i = 0; i < numWrapSegments - 2; i++) {\n-        double wangle = angle * (i+1) / (numWrapSegments - 1) * SimTK_DEGREE_TO_RADIAN;\n+\t\tdouble wangle = angle * (i+1) / (numWrapSegments - 1) * SimTK_DEGREE_TO_RADIAN;\n \n-        WrapMath::ConvertAxisAngleTo4x4DirCosMatrix(Vec3::getAs(axis), wangle, mat);\n-        Mtx::Multiply(4, 4, 1, (double*)mat, (double*)vec, (double*)rotvec);\n+\t\tWrapMath::ConvertAxisAngleTo4x4DirCosMatrix(Vec3::getAs(axis), wangle, mat);\n+\t\tMtx::Multiply(4, 4, 1, (double*)mat, (double*)vec, (double*)rotvec);\n \n-        SimTK::Vec3 wp;\n-        for (j = 0; j < 3; j++)\n-            wp[j] = origin[j] + rotvec[j];\n-        //SimmPoint wppt(wp);\n-        aWrapResult.wrap_pts.append(wp);\n+\t\tSimTK::Vec3 wp;\n+\t\tfor (j = 0; j < 3; j++)\n+\t\t\twp[j] = origin[j] + rotvec[j];\n+\t\t//SimmPoint wppt(wp);\n+\t\taWrapResult.wrap_pts.append(wp);\n    }\n \n-    //SimmPoint sp2(aWrapResult.r2);\n-    aWrapResult.wrap_pts.append(aWrapResult.r2);\n+\t//SimmPoint sp2(aWrapResult.r2);\n+\taWrapResult.wrap_pts.append(aWrapResult.r2);\n \n    return return_code;\n }\ndiff --git a/OpenSim/Simulation/Wrap/WrapSphere.h b/OpenSim/Simulation/Wrap/WrapSphere.h\nindex 8ccee8884..b687d3b7d 100644\n--- a/OpenSim/Simulation/Wrap/WrapSphere.h\n+++ b/OpenSim/Simulation/Wrap/WrapSphere.h\n@@ -29,13 +29,12 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n+#include <OpenSim/Common/Geometry.h>\n #include "WrapObject.h"\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathPoint;\ndiff --git a/OpenSim/Simulation/Wrap/WrapSphereObst.cpp b/OpenSim/Simulation/Wrap/WrapSphereObst.cpp\nindex af61746cb..28db092f9 100644\n--- a/OpenSim/Simulation/Wrap/WrapSphereObst.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapSphereObst.cpp\n@@ -50,8 +50,8 @@ WrapObject(),\n _radius(_radiusProp.getValueDbl()),\n _length(_lengthProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -73,9 +73,9 @@ WrapObject(aWrapSphereObst),\n _radius(_radiusProp.getValueDbl()),\n _length(_lengthProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapSphereObst);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapSphereObst);\n }\n \n //=============================================================================\n@@ -95,16 +95,16 @@ void WrapSphereObst::setNull()\n */\n void WrapSphereObst::setupProperties()\n {\n-    // BASE CLASS\n-    WrapObject::setupProperties();\n+\t// BASE CLASS\n+\tWrapObject::setupProperties();\n \n-    _radiusProp.setName("radius");\n-    _radiusProp.setValue(-1.0);\n-    _propertySet.append(&_radiusProp);\n+\t_radiusProp.setName("radius");\n+\t_radiusProp.setValue(-1.0);\n+\t_propertySet.append(&_radiusProp);\n \n-    _lengthProp.setName("length");\n-    _lengthProp.setValue(1.0);\n-    _propertySet.append(&_lengthProp);\n+\t_lengthProp.setName("length");\n+\t_lengthProp.setValue(1.0);\n+\t_propertySet.append(&_lengthProp);\n }\n \n //_____________________________________________________________________________\n@@ -116,20 +116,18 @@ void WrapSphereObst::setupProperties()\n */\n void WrapSphereObst::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n {\n-    // Base class\n-    Super::connectToModelAndBody(aModel, aBody);\n+\t// Base class\n+\tSuper::connectToModelAndBody(aModel, aBody);\n \n-    // maybe set a parent pointer, _body = aBody;\n-    if (_radius < 0.0)\n-    {\n-        string errorMessage = "Error: radius for WrapSphereObst " + getName() + " was either not specified, or is negative.";\n-        throw Exception(errorMessage);\n-    }\n+\t// maybe set a parent pointer, _body = aBody;\n+\tif (_radius < 0.0)\n+\t{\n+\t\tstring errorMessage = "Error: radius for WrapSphereObst " + getName() + " was either not specified, or is negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n \n-    _displayer.freeGeometry();\n-    AnalyticSphere* sph = new AnalyticSphere(_radius);\n-    setGeometryQuadrants(sph);\n-    _displayer.addGeometry(sph);\n+\tAnalyticSphere* sph = new AnalyticSphere(_radius);\n+\tsetGeometryQuadrants(sph);\n \n }\n \n@@ -141,11 +139,11 @@ void WrapSphereObst::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n */\n void WrapSphereObst::copyData(const WrapSphereObst& aWrapSphereObst)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapSphereObst);\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapSphereObst);\n \n-    _radius = aWrapSphereObst._radius;\n-    _length = aWrapSphereObst._length;\n+\t_radius = aWrapSphereObst._radius;\n+\t_length = aWrapSphereObst._length;\n }\n \n //_____________________________________________________________________________\n@@ -156,7 +154,7 @@ void WrapSphereObst::copyData(const WrapSphereObst& aWrapSphereObst)\n  */\n const char* WrapSphereObst::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -169,10 +167,10 @@ const char* WrapSphereObst::getWrapTypeName() const\n  */\n string WrapSphereObst::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _radius << "\\nheight " << _length;\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _radius << "\\nheight " << _length;\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n \n //=============================================================================\n@@ -186,10 +184,10 @@ string WrapSphereObst::getDimensionsString() const\n */\n WrapSphereObst& WrapSphereObst::operator=(const WrapSphereObst& aWrapSphereObst)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapSphereObst);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapSphereObst);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n \n@@ -208,58 +206,58 @@ WrapSphereObst& WrapSphereObst::operator=(const WrapSphereObst& aWrapSphereObst)\n  * @return The status, as a WrapAction enum\n  */\n int WrapSphereObst::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                        const PathWrap& aMuscleWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\tconst PathWrap& aMuscleWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n-    SimTK::Vec3& aPointP = aPoint1;     double R=0.8*_radius;\n-    SimTK::Vec3& aPointS = aPoint2;     double Qx,Qy, Tx,Ty;\n-//  cout << aPointP << " " << aPointS << "\\n";\n-\n-    // Initialize return values\n-    aFlag = false;\n-    aWrapResult.wrap_path_length = 0.0;\n-    aWrapResult.wrap_pts.setSize(0);\n-    \n-    // Establish a local wrap coordinate system aligned with wrapping plane\n-    SimTK::Vec3 aXvec = aPointP;                aXvec = aXvec.normalize();  // X = P\n-    SimTK::Vec3 aZvec = aPointP % aPointS;\n-    if(aZvec.norm()<=1.e-7) {\n-        printf("WrapSphereObst: P and S are colinear with sphere center (no unique solution)\\n");\n-        return insideRadius;\n-    }                                           aZvec = aZvec.normalize();  // Z = P x S\n-    SimTK::Vec3 aYvec = aZvec % aXvec;          aYvec = aYvec.normalize();  // Y = Z x X\n-    \n-    // Compute displacements of P and S from sphere center within wrap coordinate system\n-    double Px=aPointP.norm(), Py=0.0, Pz=0.0,               dP=Px*Px+Py*Py,  rootP=dP-R*R;\n-    double Sx=~aPointS*aXvec, Sy=~aPointS*aYvec, Sz=0.0,    dS=Sx*Sx+Sy*Sy,  rootS=dS-R*R;\n-\n-    // Check P and S against sphere, and compute x and y components of wrap points Q and T\n-    if( rootP<0.0 || rootS<0.0 ) return insideRadius;   // One of P or S lies within the sphere\n-    dP=R/dP;    rootP=sqrt(rootP);  Qx=(R*Px-rootP*Py)*dP;  Qy=(R*Py+rootP*Px)*dP;\n-    dS=R/dS;    rootS=sqrt(rootS);  Tx=(R*Sx+rootS*Sy)*dS;  Ty=(R*Sy-rootS*Sx)*dS;\n-    // NOTE:  Qz and Tz are necessarily zero in the wrapping plane coordinate system since by definition they lie in the plane\n-\n-    // Apply the 180-degree wrapping rule to see if contact is appropriate (i.e. wrap > 180 = no contact)\n-    if( R*(Qx*Ty-Qy*Tx) < 0.0 ) return noWrap;\n-\n-    // Compute respective wrapping segment lengths\n-    double PQ = sqrt( (Qx-Px)*(Qx-Px) + (Qy-Py)*(Qy-Py) );\n-    double TS = sqrt( (Tx-Sx)*(Tx-Sx) + (Ty-Sy)*(Ty-Sy) );\n-    double QT = R*acos( 1.0 - 0.5*( (Qx-Tx)*(Qx-Tx) + (Qy-Ty)*(Qy-Ty) )/(R*R) );\n-    if(QT<0.0) QT=-QT;\n-    \n-    // Transform Q and T from wrap coordinate system back into obstacle coordinate system\n-    SimTK::Vec3 aPointQ = (aXvec*Qx) + (aYvec*Qy);\n-    SimTK::Vec3 aPointT = (aXvec*Tx) + (aYvec*Ty);\n-\n-    // Register results and return\n-    aFlag = true;\n-    aWrapResult.wrap_path_length = QT;  // PQ + TS + QT;\n-    aWrapResult.r1=aPointQ;     //SimmPoint wppt1(aWrapResult.r1);  \n-    aWrapResult.wrap_pts.append(aWrapResult.r1);\n-    aWrapResult.r2=aPointT;     //SimmPoint wppt2(aWrapResult.r2);  \n-    aWrapResult.wrap_pts.append(aWrapResult.r2);\n-\n-    return wrapped;\n+\tSimTK::Vec3& aPointP = aPoint1;\t\tdouble R=0.8*_radius;\n+\tSimTK::Vec3& aPointS = aPoint2;\t\tdouble Qx,Qy, Tx,Ty;\n+//\tcout << aPointP << " " << aPointS << "\\n";\n+\n+\t// Initialize return values\n+\taFlag = false;\n+\taWrapResult.wrap_path_length = 0.0;\n+\taWrapResult.wrap_pts.setSize(0);\n+\t\n+\t// Establish a local wrap coordinate system aligned with wrapping plane\n+\tSimTK::Vec3 aXvec = aPointP;\t\t\t\taXvec = aXvec.normalize();\t// X = P\n+\tSimTK::Vec3 aZvec = aPointP % aPointS;\n+\tif(aZvec.norm()<=1.e-7) {\n+\t\tprintf("WrapSphereObst: P and S are colinear with sphere center (no unique solution)\\n");\n+\t\treturn insideRadius;\n+\t}\t\t\t\t\t\t\t\t\t\t\taZvec = aZvec.normalize();\t// Z = P x S\n+\tSimTK::Vec3 aYvec = aZvec % aXvec;\t\t\taYvec = aYvec.normalize();\t// Y = Z x X\n+\t\n+\t// Compute displacements of P and S from sphere center within wrap coordinate system\n+\tdouble Px=aPointP.norm(), Py=0.0, Pz=0.0,\t\t\t\tdP=Px*Px+Py*Py,  rootP=dP-R*R;\n+\tdouble Sx=~aPointS*aXvec, Sy=~aPointS*aYvec, Sz=0.0,\tdS=Sx*Sx+Sy*Sy,  rootS=dS-R*R;\n+\n+\t// Check P and S against sphere, and compute x and y components of wrap points Q and T\n+\tif( rootP<0.0 || rootS<0.0 ) return insideRadius;\t// One of P or S lies within the sphere\n+\tdP=R/dP;\trootP=sqrt(rootP);\tQx=(R*Px-rootP*Py)*dP;\tQy=(R*Py+rootP*Px)*dP;\n+\tdS=R/dS;\trootS=sqrt(rootS);\tTx=(R*Sx+rootS*Sy)*dS;\tTy=(R*Sy-rootS*Sx)*dS;\n+\t// NOTE:  Qz and Tz are necessarily zero in the wrapping plane coordinate system since by definition they lie in the plane\n+\n+\t// Apply the 180-degree wrapping rule to see if contact is appropriate (i.e. wrap > 180 = no contact)\n+\tif( R*(Qx*Ty-Qy*Tx) < 0.0 ) return noWrap;\n+\n+\t// Compute respective wrapping segment lengths\n+\tdouble PQ = sqrt( (Qx-Px)*(Qx-Px) + (Qy-Py)*(Qy-Py) );\n+\tdouble TS = sqrt( (Tx-Sx)*(Tx-Sx) + (Ty-Sy)*(Ty-Sy) );\n+\tdouble QT = R*acos( 1.0 - 0.5*( (Qx-Tx)*(Qx-Tx) + (Qy-Ty)*(Qy-Ty) )/(R*R) );\n+\tif(QT<0.0) QT=-QT;\n+\t\n+\t// Transform Q and T from wrap coordinate system back into obstacle coordinate system\n+\tSimTK::Vec3 aPointQ = (aXvec*Qx) + (aYvec*Qy);\n+\tSimTK::Vec3 aPointT = (aXvec*Tx) + (aYvec*Ty);\n+\n+\t// Register results and return\n+\taFlag = true;\n+\taWrapResult.wrap_path_length = QT;\t// PQ + TS + QT;\n+\taWrapResult.r1=aPointQ;  \t//SimmPoint wppt1(aWrapResult.r1);\t\n+\taWrapResult.wrap_pts.append(aWrapResult.r1);\n+\taWrapResult.r2=aPointT;\t\t//SimmPoint wppt2(aWrapResult.r2);\t\n+\taWrapResult.wrap_pts.append(aWrapResult.r2);\n+\n+\treturn wrapped;\n }\n \n \ndiff --git a/OpenSim/Simulation/Wrap/WrapSphereObst.h b/OpenSim/Simulation/Wrap/WrapSphereObst.h\nindex 6768b7bce..3b9c4a091 100644\n--- a/OpenSim/Simulation/Wrap/WrapSphereObst.h\n+++ b/OpenSim/Simulation/Wrap/WrapSphereObst.h\n@@ -26,13 +26,11 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n #include <OpenSim/Simulation/Wrap/WrapObject.h>\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathPoint;\ndiff --git a/OpenSim/Simulation/Wrap/WrapTorus.cpp b/OpenSim/Simulation/Wrap/WrapTorus.cpp\nindex 29f1473e7..8c02e3fda 100644\n--- a/OpenSim/Simulation/Wrap/WrapTorus.cpp\n+++ b/OpenSim/Simulation/Wrap/WrapTorus.cpp\n@@ -53,12 +53,12 @@ static const char* wrapTypeName = "torus";\n  * Default constructor.\n  */\n WrapTorus::WrapTorus() :\n-    WrapObject(),\n+\tWrapObject(),\n    _innerRadius(_innerRadiusProp.getValueDbl()),\n    _outerRadius(_outerRadiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n+\tsetNull();\n+\tsetupProperties();\n }\n \n //_____________________________________________________________________________\n@@ -76,13 +76,13 @@ WrapTorus::~WrapTorus()\n  * @param aWrapTorus WrapTorus to be copied.\n  */\n WrapTorus::WrapTorus(const WrapTorus& aWrapTorus) :\n-    WrapObject(aWrapTorus),\n+\tWrapObject(aWrapTorus),\n    _innerRadius(_innerRadiusProp.getValueDbl()),\n    _outerRadius(_outerRadiusProp.getValueDbl())\n {\n-    setNull();\n-    setupProperties();\n-    copyData(aWrapTorus);\n+\tsetNull();\n+\tsetupProperties();\n+\tcopyData(aWrapTorus);\n }\n \n \n@@ -103,16 +103,16 @@ void WrapTorus::setNull()\n  */\n void WrapTorus::setupProperties()\n {\n-    // BASE CLASS\n-    //WrapObject::setupProperties();\n+\t// BASE CLASS\n+\t//WrapObject::setupProperties();\n \n-    _innerRadiusProp.setName("inner_radius");\n-    _innerRadiusProp.setValue(-1.0);\n-    _propertySet.append(&_innerRadiusProp);\n+\t_innerRadiusProp.setName("inner_radius");\n+\t_innerRadiusProp.setValue(-1.0);\n+\t_propertySet.append(&_innerRadiusProp);\n \n-    _outerRadiusProp.setName("outer_radius");\n-    _outerRadiusProp.setValue(-1.0);\n-    _propertySet.append(&_outerRadiusProp);\n+\t_outerRadiusProp.setName("outer_radius");\n+\t_outerRadiusProp.setValue(-1.0);\n+\t_propertySet.append(&_outerRadiusProp);\n }\n \n //_____________________________________________________________________________\n@@ -127,19 +127,19 @@ void WrapTorus::scale(const SimTK::Vec3& aScaleFactors)\n    // Base class, to scale origin in body frame\n    WrapObject::scale(aScaleFactors);\n \n-    SimTK::Vec3 localScaleVector[2]; // only need X and Y for torus\n+\tSimTK::Vec3 localScaleVector[2]; // only need X and Y for torus\n \n    // _pose.x() holds the torus\'s X axis expressed in the\n    // body\'s reference frame, and _pose.y() holds the Y.\n    // Multiplying these vectors by the scale factor vector gives\n-    // localScaleVector[]. The magnitudes of the localScaleVectors\n-    // gives the amount to scale the torus in the XYZ dimensions.\n-    // The wrap torus is oriented along the Z axis, so the inner and\n-    // outer radii are scaled by the average of the X and Y scale factors.\n-    for (int i=0; i<3; i++) {\n-        localScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i];\n-        localScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i];\n-    }\n+\t// localScaleVector[]. The magnitudes of the localScaleVectors\n+\t// gives the amount to scale the torus in the XYZ dimensions.\n+\t// The wrap torus is oriented along the Z axis, so the inner and\n+\t// outer radii are scaled by the average of the X and Y scale factors.\n+\tfor (int i=0; i<3; i++) {\n+\t\tlocalScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i];\n+\t\tlocalScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i];\n+\t}\n \n    double averageXYScale = (localScaleVector[0].norm() + localScaleVector[1].norm()) * 0.5;\n    _innerRadius *= averageXYScale;\n@@ -155,26 +155,24 @@ void WrapTorus::scale(const SimTK::Vec3& aScaleFactors)\n  */\n void WrapTorus::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n {\n-    // Base class\n-    Super::connectToModelAndBody(aModel, aBody);\n+\t// Base class\n+\tSuper::connectToModelAndBody(aModel, aBody);\n \n    // maybe set a parent pointer, _body = aBody;\n \n-    if (_innerRadius < 0.0)\n-    {\n-        string errorMessage = "Error: inner_radius for WrapTorus " + getName() + " was either not specified, or is negative.";\n-        throw Exception(errorMessage);\n-    }\n-\n-    if (_outerRadius <= _innerRadius)\n-    {\n-        string errorMessage = "Error: outer_radius for WrapTorus " + getName() + " is less than or equal to inner_radius.";\n-        throw Exception(errorMessage);\n-    }\n-    _displayer.freeGeometry();\n-    AnalyticTorus* torus = new AnalyticTorus(_innerRadius, (_outerRadius-_innerRadius));\n-    setGeometryQuadrants(torus);\n-    _displayer.addGeometry(torus);\n+\tif (_innerRadius < 0.0)\n+\t{\n+\t\tstring errorMessage = "Error: inner_radius for WrapTorus " + getName() + " was either not specified, or is negative.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\n+\tif (_outerRadius <= _innerRadius)\n+\t{\n+\t\tstring errorMessage = "Error: outer_radius for WrapTorus " + getName() + " is less than or equal to inner_radius.";\n+\t\tthrow Exception(errorMessage);\n+\t}\n+\tAnalyticTorus* torus = new AnalyticTorus(_innerRadius, (_outerRadius-_innerRadius));\n+\tsetGeometryQuadrants(torus);\n }\n \n //_____________________________________________________________________________\n@@ -185,11 +183,11 @@ void WrapTorus::connectToModelAndBody(Model& aModel, PhysicalFrame& aBody)\n  */\n void WrapTorus::copyData(const WrapTorus& aWrapTorus)\n {\n-    // BASE CLASS\n-    WrapObject::copyData(aWrapTorus);\n+\t// BASE CLASS\n+\tWrapObject::copyData(aWrapTorus);\n \n-    _innerRadius = aWrapTorus._innerRadius;\n-    _outerRadius = aWrapTorus._outerRadius;\n+\t_innerRadius = aWrapTorus._innerRadius;\n+\t_outerRadius = aWrapTorus._outerRadius;\n }\n \n //_____________________________________________________________________________\n@@ -200,7 +198,7 @@ void WrapTorus::copyData(const WrapTorus& aWrapTorus)\n  */\n const char* WrapTorus::getWrapTypeName() const\n {\n-    return wrapTypeName;\n+\treturn wrapTypeName;\n }\n \n //_____________________________________________________________________________\n@@ -213,10 +211,10 @@ const char* WrapTorus::getWrapTypeName() const\n  */\n string WrapTorus::getDimensionsString() const\n {\n-    stringstream dimensions;\n-    dimensions << "radius " << _innerRadius << " " << _outerRadius;\n+\tstringstream dimensions;\n+\tdimensions << "radius " << _innerRadius << " " << _outerRadius;\n \n-    return dimensions.str();\n+\treturn dimensions.str();\n }\n //_____________________________________________________________________________\n /**\n@@ -249,10 +247,10 @@ SimTK::Real WrapTorus::getOuterRadius() const\n  */\n WrapTorus& WrapTorus::operator=(const WrapTorus& aWrapTorus)\n {\n-    // BASE CLASS\n-    WrapObject::operator=(aWrapTorus);\n+\t// BASE CLASS\n+\tWrapObject::operator=(aWrapTorus);\n \n-    return(*this);\n+\treturn(*this);\n }\n \n //=============================================================================\n@@ -270,53 +268,53 @@ WrapTorus& WrapTorus::operator=(const WrapTorus& aWrapTorus)\n  * @return The status, as a WrapAction enum\n  */\n int WrapTorus::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n-                                const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n+\t\t\t\t\t\t\t\tconst PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const\n {\n-    int i;\n-    SimTK::Vec3 closestPt;\n-    bool constrained = (bool) (_wrapSign != 0);\n-    bool far_side_wrap = false;\n-    aFlag = true;\n-\n-    if (findClosestPoint(_outerRadius, &aPoint1[0], &aPoint2[0], &closestPt[0], &closestPt[1], &closestPt[2], _wrapSign, _wrapAxis) == 0)\n-        return noWrap;\n-\n-    // Now put a cylinder at closestPt and call the cylinder wrap code.\n-    WrapCylinder cyl;//(rot, trans, quadrant, body, radius, length);\n-    SimTK::Vec3 cylXaxis, cylYaxis, cylZaxis; // cylinder axes in torus reference frame\n-\n-    cyl.setRadius(_innerRadius);\n-    cyl.setLength(CYL_LENGTH);\n-    cyl.setQuadrantName("+x");\n-\n-    closestPt *= -1;\n-\n-    cylXaxis = closestPt;\n-    Mtx::Normalize(3, cylXaxis, cylXaxis);\n-    cylYaxis[0] = 0.0;\n-    cylYaxis[1] = 0.0;\n-    cylYaxis[2] = -1.0;\n-    Mtx::CrossProduct(cylXaxis, cylYaxis, cylZaxis);\n-    // Note: you don\'t need to recalculate Y as Z x X because X and Z are always in the XY plane, so Y will remain 0 0 -1.\n-\n-    // cylinderToTorus is the transform from the cylinder to the torus.\n-    // The origin of the cylinder frame in the torus frame is closestPt.\n-    // closestPtCyl is along the X axis of the cylinder since cylXaxis = closestPt.\n-    SimTK::Transform cylinderToTorus(SimTK::Rotation(SimTK::Mat33(cylXaxis[0], cylXaxis[1], cylXaxis[2],\n-        cylYaxis[0], cylYaxis[1], cylYaxis[2], cylZaxis[0], cylZaxis[1], cylZaxis[2])));\n-    SimTK::Vec3 closestPtCyl = cylinderToTorus.shiftFrameStationToBase(closestPt);\n-    cylinderToTorus.setP(closestPtCyl);\n-    Vec3 p1 = cylinderToTorus.shiftFrameStationToBase(aPoint1);\n-    Vec3 p2 = cylinderToTorus.shiftFrameStationToBase(aPoint2);\n-    int return_code = cyl.wrapLine(s, p1, p2, aPathWrap, aWrapResult, aFlag);\n+\tint i;\n+\tSimTK::Vec3 closestPt;\n+\tbool constrained = (bool) (_wrapSign != 0);\n+\tbool far_side_wrap = false;\n+\taFlag = true;\n+\n+\tif (findClosestPoint(_outerRadius, &aPoint1[0], &aPoint2[0], &closestPt[0], &closestPt[1], &closestPt[2], _wrapSign, _wrapAxis) == 0)\n+\t\treturn noWrap;\n+\n+\t// Now put a cylinder at closestPt and call the cylinder wrap code.\n+\tWrapCylinder cyl;//(rot, trans, quadrant, body, radius, length);\n+\tSimTK::Vec3 cylXaxis, cylYaxis, cylZaxis; // cylinder axes in torus reference frame\n+\n+\tcyl.setRadius(_innerRadius);\n+\tcyl.setLength(CYL_LENGTH);\n+\tcyl.setQuadrantName("+x");\n+\n+\tclosestPt *= -1;\n+\n+\tcylXaxis = closestPt;\n+\tMtx::Normalize(3, cylXaxis, cylXaxis);\n+\tcylYaxis[0] = 0.0;\n+\tcylYaxis[1] = 0.0;\n+\tcylYaxis[2] = -1.0;\n+\tMtx::CrossProduct(cylXaxis, cylYaxis, cylZaxis);\n+\t// Note: you don\'t need to recalculate Y as Z x X because X and Z are always in the XY plane, so Y will remain 0 0 -1.\n+\n+\t// cylinderToTorus is the transform from the cylinder to the torus.\n+\t// The origin of the cylinder frame in the torus frame is closestPt.\n+\t// closestPtCyl is along the X axis of the cylinder since cylXaxis = closestPt.\n+\tSimTK::Transform cylinderToTorus(SimTK::Rotation(SimTK::Mat33(cylXaxis[0], cylXaxis[1], cylXaxis[2],\n+\t\tcylYaxis[0], cylYaxis[1], cylYaxis[2], cylZaxis[0], cylZaxis[1], cylZaxis[2])));\n+\tSimTK::Vec3 closestPtCyl = cylinderToTorus.shiftFrameStationToBase(closestPt);\n+\tcylinderToTorus.setP(closestPtCyl);\n+\tVec3 p1 = cylinderToTorus.shiftFrameStationToBase(aPoint1);\n+\tVec3 p2 = cylinderToTorus.shiftFrameStationToBase(aPoint2);\n+\tint return_code = cyl.wrapLine(s, p1, p2, aPathWrap, aWrapResult, aFlag);\n    if (aFlag == true && return_code > 0) {\n-        aWrapResult.r1 = cylinderToTorus.shiftBaseStationToFrame(aWrapResult.r1);\n-        aWrapResult.r2 = cylinderToTorus.shiftBaseStationToFrame(aWrapResult.r2);\n-        for (i = 0; i < aWrapResult.wrap_pts.getSize(); i++)\n-            aWrapResult.wrap_pts.updElt(i) = cylinderToTorus.shiftBaseStationToFrame(aWrapResult.wrap_pts.get(i));\n-    }\n+\t\taWrapResult.r1 = cylinderToTorus.shiftBaseStationToFrame(aWrapResult.r1);\n+\t\taWrapResult.r2 = cylinderToTorus.shiftBaseStationToFrame(aWrapResult.r2);\n+\t\tfor (i = 0; i < aWrapResult.wrap_pts.getSize(); i++)\n+\t\t\taWrapResult.wrap_pts.updElt(i) = cylinderToTorus.shiftBaseStationToFrame(aWrapResult.wrap_pts.get(i));\n+\t}\n \n-    return wrapped;\n+\treturn wrapped;\n }\n \n //_____________________________________________________________________________\n@@ -336,8 +334,8 @@ int WrapTorus::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3\n  * @return \'1\' if a closest point was found, \'0\' if there was an error while trying to constrain the wrap\n  */\n int WrapTorus::findClosestPoint(double radius, double p1[], double p2[],\n-                                          double* xc, double* yc, double* zc,\n-                                          int wrap_sign, int wrap_axis) const\n+\t\t\t\t\t\t\t\t\t\t  double* xc, double* yc, double* zc,\n+\t\t\t\t\t\t\t\t\t\t  int wrap_sign, int wrap_axis) const\n {\n    int info;                  // output flag\n    int num_func_calls;        // number of calls to func (nfev)\n@@ -494,7 +492,7 @@ int WrapTorus::findClosestPoint(double radius, double p1[], double p2[],\n  * @param ptr Pointer to data structure containing current point and circle radius\n  */\n void WrapTorus::calcCircleResids(int numResid, int numQs, double q[],\n-                                            double resid[], int *flag2, void *ptr)\n+\t\t\t\t\t\t\t\t\t\t\tdouble resid[], int *flag2, void *ptr)\n {\n    double mag, nx, ny, nz, u;\n    double c2, c3, c4, c5, c6;\ndiff --git a/OpenSim/Simulation/Wrap/WrapTorus.h b/OpenSim/Simulation/Wrap/WrapTorus.h\nindex c7d3a8cd4..8bde17df7 100644\n--- a/OpenSim/Simulation/Wrap/WrapTorus.h\n+++ b/OpenSim/Simulation/Wrap/WrapTorus.h\n@@ -29,13 +29,11 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n #include "WrapObject.h"\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathPoint;\ndiff --git a/OpenSim/Utilities/simmFileWriterDLL/SimbodySimmBody.cpp b/OpenSim/Utilities/simmFileWriterDLL/SimbodySimmBody.cpp\nindex 31a3d0cc4..28a2e1dc2 100644\n--- a/OpenSim/Utilities/simmFileWriterDLL/SimbodySimmBody.cpp\n+++ b/OpenSim/Utilities/simmFileWriterDLL/SimbodySimmBody.cpp\n@@ -99,6 +99,7 @@ void SimbodySimmBody::write(ofstream& aStream)\n       aStream << "        " << inertia[2][0] << " " << inertia[2][1] << " " << inertia[2][2] << endl;\n \n       string fileName;\n+      /*\n       for (int i = 0; i < _body->getDisplayer()->getNumGeometryFiles(); i++)\n       {\n          fileName = _body->getDisplayer()->getGeometryFileName(i);\n@@ -107,7 +108,7 @@ void SimbodySimmBody::write(ofstream& aStream)\n             fileName.erase(dot, 4);\n          fileName += ".asc";\n          aStream << "bone " << fileName << endl;\n-      }\n+      }*/\n \n       const MarkerSet& markerSet = _body->getModel().getMarkerSet();\n       for (int i = 0; i < markerSet.getSize(); i++)\n@@ -134,7 +135,7 @@ void SimbodySimmBody::write(ofstream& aStream)\n       }\n \n       SimTK::Vec3 scaleFactors;\n-      _body->getDisplayer()->getScaleFactors(scaleFactors);\n+     // _body->getDisplayer()->getScaleFactors(scaleFactors);\n \n       aStream << "scale " << scaleFactors[0] << " " << scaleFactors[1] << " " << scaleFactors[2] << endl;\n    } else {\ndiff --git a/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.cpp b/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.cpp\nindex 1a062699d..14f1a401b 100644\n--- a/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.cpp\n+++ b/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.cpp\n@@ -138,8 +138,8 @@ void OpenSimContext::updateDisplayer(Force& f) {\n     Object& pathObj = pathProp.updValueAsObject();\n     return dynamic_cast<GeometryPath*>(&pathObj)->updateDisplayer(*_configState);\n   }\n-  if (f.getDisplayer()!= NULL)\n-    f.updateDisplayer(*_configState);\n+/*  if (f.getDisplayer()!= NULL)\n+    f.updateDisplayer(*_configState);*/\n }\n \n void OpenSimContext::copyMuscle(Muscle& from, Muscle& to) {\ndiff --git a/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.h b/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.h\nindex 22cdc5918..a111213af 100644\n--- a/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.h\n+++ b/OpenSim/Wrapping/Java/OpenSimJNI/OpenSimContext.h\n@@ -24,6 +24,7 @@\n  * -------------------------------------------------------------------------- */\n \n #include <OpenSim/Common/Object.h>\n+#include <OpenSim/Common/PropertyTransform.h>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Simulation/Model/Model.h>\n #include <OpenSim/Simulation/Model/Force.h>\ndiff --git a/OpenSim/Wrapping/Java/swig/javaWrapOpenSim.i b/OpenSim/Wrapping/Java/swig/javaWrapOpenSim.i\nindex 7921d8725..1c08b3e10 100644\n--- a/OpenSim/Wrapping/Java/swig/javaWrapOpenSim.i\n+++ b/OpenSim/Wrapping/Java/swig/javaWrapOpenSim.i\n@@ -15,10 +15,7 @@\n #include <OpenSim/Common/Object.h>\n #include <OpenSim/Common/ObjectGroup.h>\n #include <OpenSim/Common/Geometry.h>\n-#include <OpenSim/Common/DisplayGeometry.h>\n #include <OpenSim/Common/Set.h>\n-#include <OpenSim/Common/GeometrySet.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/StateVector.h>\n #include <OpenSim/Common/StorageInterface.h>\n #include <OpenSim/Common/Storage.h>\n@@ -746,11 +743,7 @@ namespace SimTK {\n %include <OpenSim/Common/Object.h>\n %include <OpenSim/Common/ObjectGroup.h>\n %include <OpenSim/Common/Geometry.h>\n-%include <OpenSim/Common/DisplayGeometry.h>\n %include <OpenSim/Common/Set.h>\n-%template(SetGeometry) OpenSim::Set<OpenSim::DisplayGeometry>;\n-%include <OpenSim/Common/GeometrySet.h>\n-%include <OpenSim/Common/VisibleObject.h>\n %include <OpenSim/Common/StateVector.h>\n %include <OpenSim/Common/StorageInterface.h>\n %include <OpenSim/Common/Storage.h>\ndiff --git a/OpenSim/Wrapping/Python/OpenSimContext.cpp b/OpenSim/Wrapping/Python/OpenSimContext.cpp\nindex 7d283d329..db69bcbf4 100644\n--- a/OpenSim/Wrapping/Python/OpenSimContext.cpp\n+++ b/OpenSim/Wrapping/Python/OpenSimContext.cpp\n@@ -138,8 +138,8 @@ void OpenSimContext::updateDisplayer(Force& f) {\n     Object& pathObj = pathProp.updValueAsObject();\n     return dynamic_cast<GeometryPath*>(&pathObj)->updateDisplayer(*_configState);\n   }\n-  if (f.getDisplayer()!= NULL)\n-    f.updateDisplayer(*_configState);\n+  /*if (f.getDisplayer()!= NULL)\n+    f.updateDisplayer(*_configState);*/\n }\n \n void OpenSimContext::copyMuscle(Muscle& from, Muscle& to) {\ndiff --git a/OpenSim/Wrapping/Python/OpenSimContext.h b/OpenSim/Wrapping/Python/OpenSimContext.h\nindex 3b1cef9db..fe7caf52c 100644\n--- a/OpenSim/Wrapping/Python/OpenSimContext.h\n+++ b/OpenSim/Wrapping/Python/OpenSimContext.h\n@@ -24,6 +24,7 @@\n  * -------------------------------------------------------------------------- */\n \n #include <OpenSim/Common/Object.h>\n+#include <OpenSim/Common/PropertyTransform.h>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Simulation/Model/Model.h>\n #include <OpenSim/Simulation/Model/Force.h>\n@@ -90,9 +91,9 @@ public:\n     void setState( SimTK::State* s) { _configState = s; }\n     void setModel( Model* m) { _model = m; }\n \n-    /** Get reference to the single instance of SimTK::State maintained by the Context object **/\n+\t/** Get reference to the single instance of SimTK::State maintained by the Context object **/\n     const SimTK::State& getCurrentStateRef() const { return (*_configState); };\n-    /** Return a "clone" of  the single instance of SimTK::State maintained by the Context object **/\n+\t/** Return a "clone" of  the single instance of SimTK::State maintained by the Context object **/\n     SimTK::State getCurrentStateCopy() const { return SimTK::State(*_configState); };\n         void recreateSystemAfterSystemExistsKeepStage(); \n         void recreateSystemAfterSystemExists(); \n@@ -102,46 +103,46 @@ public:\n              setState( newState );\n             _model->getMultibodySystem().realize( *_configState, stageBeforeRecreatingSystem );\n         }\n-    // Transforms\n+\t// Transforms\n     void transformPosition(const Body& body, double offset[], double gOffset[]);\n-    Transform getTransform(const Body& body);\n-    void transform(const Body& ground, double d[], Body& body, double dragVectorBody[]);\n-    // Coordinates\n+    SimTK::Transform getTransform(const Body& body);\n+\tvoid transform(const Body& ground, double d[], Body& body, double dragVectorBody[]);\n+\t// Coordinates\n     double getValue(const Coordinate& coord);\n-    bool getLocked(const Coordinate& coord);\n-    void setValue(const Coordinate& coord, double d, bool enforceConstraints=true);\n-    void setClamped(Coordinate& coord, bool newValue);\n-    bool getClamped(const Coordinate& coord);\n-    void setLocked(Coordinate& coord, bool newValue);\n-    bool isPrescribed(const Coordinate& coord) const;\n-    bool isConstrained(const Coordinate& coord) const;\n-    // Constraints\n-    bool isDisabled(const Constraint& constraint) const {\n-        return  constraint.isDisabled(*_configState);\n-    }\n-    void setDisabled(Constraint& constraint, bool disable) {\n-        constraint.setDisabled(*_configState, disable);\n-        _model->assemble(*_configState);\n-    }\n-    // Forces\n-    bool isDisabled(const Force& force) const {\n-        return  force.isDisabled(*_configState);\n-    }\n-    void setDisabled(Force& force, bool disable) const {\n-        force.setDisabled(*_configState, disable);\n-        _model->getMultibodySystem().realize(*_configState, SimTK::Stage::Position);\n-    }\n-    // Muscles\n-    double getActivation(Muscle& act);\n-    double getMuscleLength(Muscle& act);\n-    const Array<PathPoint*>& getCurrentPath(Muscle& act);\n-    const Array<PathPoint*>& getCurrentDisplayPath(GeometryPath& path);\n-    void updateDisplayer(Force& f);\n+\tbool getLocked(const Coordinate& coord);\n+\tvoid setValue(const Coordinate& coord, double d, bool enforceConstraints=true);\n+\tvoid setClamped(Coordinate& coord, bool newValue);\n+\tbool getClamped(const Coordinate& coord);\n+\tvoid setLocked(Coordinate& coord, bool newValue);\n+\tbool isPrescribed(const Coordinate& coord) const;\n+\tbool isConstrained(const Coordinate& coord) const;\n+\t// Constraints\n+\tbool isDisabled(const Constraint& constraint) const {\n+\t\treturn  constraint.isDisabled(*_configState);\n+\t}\n+\tvoid setDisabled(Constraint& constraint, bool disable) {\n+\t\tconstraint.setDisabled(*_configState, disable);\n+\t\t_model->assemble(*_configState);\n+\t}\n+\t// Forces\n+\tbool isDisabled(const Force& force) const {\n+\t\treturn  force.isDisabled(*_configState);\n+\t}\n+\tvoid setDisabled(Force& force, bool disable) const {\n+\t\tforce.setDisabled(*_configState, disable);\n+\t\t_model->getMultibodySystem().realize(*_configState, SimTK::Stage::Position);\n+\t}\n+\t// Muscles\n+\tdouble getActivation(Muscle& act);\n+\tdouble getMuscleLength(Muscle& act);\n+\tconst Array<PathPoint*>& getCurrentPath(Muscle& act);\n+\tconst Array<PathPoint*>& getCurrentDisplayPath(GeometryPath& path);\n+\tvoid updateDisplayer(Force& f);\n     void copyMuscle(Muscle& from, Muscle& to);\n-    void replacePropertyFunction(OpenSim::Object& obj, OpenSim::Function* aOldFunction, OpenSim::Function* aNewFunction);\n+\tvoid replacePropertyFunction(OpenSim::Object& obj, OpenSim::Function* aOldFunction, OpenSim::Function* aNewFunction);\n \n-    // Muscle Points\n-    void setXFunction(MovingPathPoint& mmp, Function& newFunction);\n+\t// Muscle Points\n+\tvoid setXFunction(MovingPathPoint& mmp, Function& newFunction);\n     void setYFunction(MovingPathPoint& mmp, Function& newFunction);\n     void setZFunction(MovingPathPoint& mmp, Function& newFunction);\n     void setXCoordinate(MovingPathPoint& mmp, Coordinate& newCoord);\n@@ -154,54 +155,54 @@ public:\n     bool replacePathPoint(GeometryPath& p, PathPoint& mp, PathPoint& newPoint);\n     void setLocation(PathPoint& mp, int i, double d);\n     void setEndPoint(PathWrap& mw, int newEndPt);\n-    void addPathPoint(GeometryPath& p, int menuChoice, Body& body);\n-    bool deletePathPoint(GeometryPath& p, int menuChoice);\n-    bool isActivePathPoint(PathPoint& mp) ; \n-    // Muscle Wrapping\n-    void setStartPoint(PathWrap& mw, int newStartPt);\n-    void addPathWrap(GeometryPath& p, WrapObject& awo);\n+\tvoid addPathPoint(GeometryPath& p, int menuChoice, Body& body);\n+\tbool deletePathPoint(GeometryPath& p, int menuChoice);\n+\tbool isActivePathPoint(PathPoint& mp) ; \n+\t// Muscle Wrapping\n+\tvoid setStartPoint(PathWrap& mw, int newStartPt);\n+\tvoid addPathWrap(GeometryPath& p, WrapObject& awo);\n     void moveUpPathWrap(GeometryPath& p, int num);\n     void moveDownPathWrap(GeometryPath& p, int num);\n     void deletePathWrap(GeometryPath& p, int num);\n-    // Markers\n-    void setBody(Marker& currentMarker, Body& newBody, bool  b);\n-    int replaceMarkerSet(Model& model, MarkerSet& aMarkerSet);\n-\n-    void getCenterOfMassInGround(double com[3]) const {\n-        SimTK::Vec3 comV = _model->getMatterSubsystem().calcSystemMassCenterLocationInGround(*_configState);\n-        for(int i=0; i<3; i++) com[i] = comV[i];\n-    }\n-    // Analyses\n-    int step(Analysis& analysis);\n-    // Tools\n-    bool solveInverseKinematics( InverseKinematicsTool& ikTool);\n-    void setStatesFromMotion(AnalyzeTool& analyzeTool, const Storage &aMotion, bool aInDegrees);\n-    void loadStatesFromFile(AnalyzeTool& analyzeTool);\n-    bool processModelScale(ModelScaler& modelScaler, \n-        Model* aModel, const std::string& aPathToSubject="", double aFinalMass = -1.0);\n-    bool processModelMarkerPlacer( MarkerPlacer& markerPlacer, \n-        Model* aModel, const std::string& aPathToSubject="");\n-    double computeMeasurementScaleFactor(ModelScaler& modelScaler, \n-        const Model& aModel, const MarkerData& aMarkerData, const Measurement& aMeasurement) const;\n+\t// Markers\n+\tvoid setBody(Marker& currentMarker, Body& newBody, bool  b);\n+\tint replaceMarkerSet(Model& model, MarkerSet& aMarkerSet);\n+\n+\tvoid getCenterOfMassInGround(double com[3]) const {\n+\t\tSimTK::Vec3 comV = _model->getMatterSubsystem().calcSystemMassCenterLocationInGround(*_configState);\n+\t\tfor(int i=0; i<3; i++) com[i] = comV[i];\n+\t}\n+\t// Analyses\n+\tint step(Analysis& analysis);\n+\t// Tools\n+\tbool solveInverseKinematics( InverseKinematicsTool& ikTool);\n+\tvoid setStatesFromMotion(AnalyzeTool& analyzeTool, const Storage &aMotion, bool aInDegrees);\n+\tvoid loadStatesFromFile(AnalyzeTool& analyzeTool);\n+\tbool processModelScale(ModelScaler& modelScaler, \n+\t\tModel* aModel, const std::string& aPathToSubject="", double aFinalMass = -1.0);\n+\tbool processModelMarkerPlacer( MarkerPlacer& markerPlacer, \n+\t\tModel* aModel, const std::string& aPathToSubject="");\n+\tdouble computeMeasurementScaleFactor(ModelScaler& modelScaler, \n+\t\tconst Model& aModel, const MarkerData& aMarkerData, const Measurement& aMeasurement) const;\n    void replaceTransformAxisFunction(TransformAxis& aDof, OpenSim::Function& aFunction);\n \n-    // Utilities\n+\t// Utilities\n     static bool isNaN( double v ) { return (SimTK::isNaN(v)); }\n \n-    double getTime() { \n-        assert(_configState); \n-        return (_configState->getTime()); \n-    }\n+\tdouble getTime() { \n+\t\tassert(_configState); \n+\t\treturn (_configState->getTime()); \n+\t}\n     // Convert SimTK::Transform into a double[] array of 16 doubles\n-    static void getTransformAsDouble16(const SimTK::Transform& aTransform, double flattened[]){\n-         double* matStart = &aTransform.toMat44()[0][0];\n-         for (int i=0; i<16; i++) flattened[i]=matStart[i];\n-    }\n+\tstatic void getTransformAsDouble16(const SimTK::Transform& aTransform, double flattened[]){\n+\t\t double* matStart = &aTransform.toMat44()[0][0];\n+\t\t for (int i=0; i<16; i++) flattened[i]=matStart[i];\n+\t}\n     // Sets the property values in the model from the current state if there\n     // are state variables that correspond to properties.\n-    void setPropertiesFromState() { \n-        _model->setPropertiesFromState(*_configState);\n-    }\n+\tvoid setPropertiesFromState() {\t\n+\t\t_model->setPropertiesFromState(*_configState);\n+\t}\n     /**\n      * Create a new System under the model then realize it to the same stage it had\n      */\n@@ -213,9 +214,9 @@ public:\n         setState( newState );\n         _model->getMultibodySystem().realize( *_configState, stageBeforeRecreatingSystem );\n     }\n-    // Force re-realization\n-    void realizePosition();\n-    void realizeVelocity();\n+\t// Force re-realization\n+\tvoid realizePosition();\n+\tvoid realizeVelocity();\n //=============================================================================\n // DATA\n //=============================================================================\n@@ -250,16 +251,16 @@ in Java data types\n \n class AnalysisWrapper : public Analysis {\n OpenSim_DECLARE_CONCRETE_OBJECT(AnalysisWrapper, Analysis);\n-    double  simulationTime;\n+\tdouble  simulationTime;\n public:\n-    AnalysisWrapper(Model *aModel=0):\n-      Analysis(aModel){\n-        simulationTime = -1.0;\n-    }\n+\tAnalysisWrapper(Model *aModel=0):\n+\t  Analysis(aModel){\n+\t\tsimulationTime = -1.0;\n+\t}\n \n-    double getSimulationTime() {\n-        return simulationTime;\n-    }\n+\tdouble getSimulationTime() {\n+\t\treturn simulationTime;\n+\t}\n \n }; // Class AnalysisWrapper\n \n@@ -275,21 +276,21 @@ is thrown.\n **/\n // Class to handle interrupts\n class InterruptCallback : public AnalysisWrapper {\n-    bool _throwException;\n+\tbool _throwException;\n public:\n-    InterruptCallback(Model *aModel=0):\n-      AnalysisWrapper(aModel),\n-      _throwException(false){};\n-\n-    void interrupt() {\n-        _throwException=true;\n-    }\n-    virtual int step( const SimTK::State& s, int stepNumber) {\n-        if (_throwException)\n-            throw Exception("Operation Aborted");\n-        return 0;\n-    }\n-    \n+\tInterruptCallback(Model *aModel=0):\n+\t  AnalysisWrapper(aModel),\n+\t  _throwException(false){};\n+\n+\tvoid interrupt() {\n+\t\t_throwException=true;\n+\t}\n+\tvirtual int step( const SimTK::State& s, int stepNumber) {\n+\t\tif (_throwException)\n+\t\t\tthrow Exception("Operation Aborted");\n+\t\treturn 0;\n+\t}\n+\t\n };\n \n //==============================================================================\ndiff --git a/OpenSim/Wrapping/Python/swig/pyWrapOpenSim.i b/OpenSim/Wrapping/Python/swig/pyWrapOpenSim.i\nindex d0a84f7b4..6455227b0 100644\n--- a/OpenSim/Wrapping/Python/swig/pyWrapOpenSim.i\n+++ b/OpenSim/Wrapping/Python/swig/pyWrapOpenSim.i\n@@ -25,10 +25,7 @@ own project.\n #include <OpenSim/Common/Object.h>\n #include <OpenSim/Common/ObjectGroup.h>\n #include <OpenSim/Common/Geometry.h>\n-#include <OpenSim/Common/DisplayGeometry.h>\n #include <OpenSim/Common/Set.h>\n-#include <OpenSim/Common/GeometrySet.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/StateVector.h>\n #include <OpenSim/Common/StorageInterface.h>\n #include <OpenSim/Common/Storage.h>\n@@ -518,11 +515,7 @@ namespace SimTK {\n %include <OpenSim/Common/Object.h>\n %include <OpenSim/Common/ObjectGroup.h>\n %include <OpenSim/Common/Geometry.h>\n-%include <OpenSim/Common/DisplayGeometry.h>\n %include <OpenSim/Common/Set.h>\n-%template(SetGeometry) OpenSim::Set<OpenSim::DisplayGeometry>;\n-%include <OpenSim/Common/GeometrySet.h>\n-%include <OpenSim/Common/VisibleObject.h>\n %include <OpenSim/Common/StateVector.h>\n %include <OpenSim/Common/StorageInterface.h>\n %include <OpenSim/Common/Storage.h>\n', 'commit_subject': 'First commit to Geometry refactoring. Remove VisibleObject, DisplayGeometry and GeometrySet and all references to them. All test cases pass.', 'repo_name': 'opensim-org/opensim-core', 'committer': {'name': 'Ayman Habib', 'email': '8ed3d36c15b09fc26f15c5d6263fa800d475ac16@stanford.edu', 'time_sec': '1429565257', 'tz_offset': '-420', 'date': {'seconds': '1429565257'}}, 'commit_tree': 'aac0807c769143c3a3b8a09f6b2dfa4779ec6186', 'commit_message': 'First commit to Geometry refactoring. Remove VisibleObject, DisplayGeometry and GeometrySet and all references to them. All test cases pass.\n\nConflicts:\n\tApplications/Scale/scale.cpp\n\tOpenSim/Actuators/McKibbenActuator.h\n\tOpenSim/Actuators/Test/testMuscles.cpp\n\tOpenSim/Common/DisplayGeometry.cpp\n\tOpenSim/Common/DisplayGeometry.h\n\tOpenSim/Common/Geometry.h\n\tOpenSim/Common/GeometrySet.h\n\tOpenSim/Common/Object.h\n\tOpenSim/Common/RegisterTypes_osimCommon.cpp\n\tOpenSim/Common/VisibleObject.cpp\n\tOpenSim/Common/VisibleObject.h\n\tOpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\n\tOpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.h\n\tOpenSim/Simulation/Model/ContactHalfSpace.cpp\n\tOpenSim/Simulation/Model/ContactMesh.cpp\n\tOpenSim/Simulation/Model/ContactSphere.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedBushingForce.h\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.h\n\tOpenSim/Simulation/Model/GeometryPath.cpp\n\tOpenSim/Simulation/Model/GeometryPath.h\n\tOpenSim/Simulation/Model/Ligament.cpp\n\tOpenSim/Simulation/Model/Ligament.h\n\tOpenSim/Simulation/Model/ModelVisualizer.cpp\n\tOpenSim/Simulation/Model/PathActuator.cpp\n\tOpenSim/Simulation/Model/PathActuator.h\n\tOpenSim/Simulation/Model/PathPoint.cpp\n\tOpenSim/Simulation/Model/PathPoint.h\n\tOpenSim/Simulation/Model/PathSpring.cpp\n\tOpenSim/Simulation/Model/PathSpring.h\n\tOpenSim/Simulation/Model/PointToPointSpring.cpp\n\tOpenSim/Simulation/Model/PointToPointSpring.h\n\tOpenSim/Simulation/SimbodyEngine/Body.cpp\n\tOpenSim/Simulation/SimbodyEngine/Body.h\n\tOpenSim/Simulation/Test/testProbes.cpp\n\tOpenSim/Simulation/Wrap/WrapCylinder.cpp\n\tOpenSim/Simulation/Wrap/WrapCylinderObst.cpp\n\tOpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp\n\tOpenSim/Simulation/Wrap/WrapEllipsoid.cpp\n\tOpenSim/Simulation/Wrap/WrapObject.cpp\n\tOpenSim/Simulation/Wrap/WrapObject.h\n\tOpenSim/Simulation/Wrap/WrapSphere.cpp\n\tOpenSim/Simulation/Wrap/WrapSphereObst.cpp\n\tOpenSim/Simulation/Wrap/WrapTorus.cpp\n\tOpenSim/Wrapping/Python/OpenSimContext.h\n\nConflicts:\n\tOpenSim/Actuators/Test/testMuscles.cpp\n\tOpenSim/Common/Object.h\n\tOpenSim/Common/RegisterTypes_osimCommon.cpp\n\tOpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\n\tOpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.h\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.h\n\tOpenSim/Simulation/Model/GeometryPath.h\n\tOpenSim/Simulation/Model/PathActuator.cpp\n\tOpenSim/Simulation/Model/PathActuator.h\n\tOpenSim/Simulation/Model/PathPoint.cpp\n\tOpenSim/Simulation/Model/PathPoint.h\n\tOpenSim/Simulation/Model/PointToPointSpring.cpp\n\tOpenSim/Simulation/Model/PointToPointSpring.h\n\tOpenSim/Simulation/SimbodyEngine/Body.cpp\n\tOpenSim/Simulation/SimbodyEngine/Body.h\n\tOpenSim/Simulation/Wrap/WrapObject.cpp\n\tOpenSim/Simulation/Wrap/WrapObject.h\n', 'language_name': 'Shell', 'license': 'apache-2.0', 'hunks': '@@ -29,13 +29,11 @@\n #include <string>\n #include <OpenSim/Simulation/osimSimulationDLL.h>\n #include <OpenSim/Common/Object.h>\n-#include <OpenSim/Common/VisibleObject.h>\n #include <OpenSim/Common/PropertyDbl.h>\n #include "WrapObject.h"\n \n namespace OpenSim {\n \n-class VisibleObject;\n class Body;\n class Model;\n class PathPoint;\n', 'addition_count': 0, 'deletion_count': 2, 'src_file': 'a/OpenSim/Simulation/Wrap/WrapTorus.h', 'tgt_file': 'b/OpenSim/Simulation/Wrap/WrapTorus.h', 'file_extension': '.h', 'before_file': '#ifndef OPENSIM_WRAP_TORUS_H_\n#define OPENSIM_WRAP_TORUS_H_\n/* -------------------------------------------------------------------------- *\n *                           OpenSim:  WrapTorus.h                            *\n * -------------------------------------------------------------------------- *\n * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *\n * See http://opensim.stanford.edu and the NOTICE file for more information.  *\n * OpenSim is developed at Stanford University and supported by the US        *\n * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *\n * through the Warrior Web program.                                           *\n *                                                                            *\n * Copyright (c) 2005-2019 Stanford University and the Authors                *\n * Author(s): Peter Loan                                                      *\n *                                                                            *\n * Licensed under the Apache License, Version 2.0 (the "License"); you may    *\n * not use this file except in compliance with the License. You may obtain a  *\n * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *\n *                                                                            *\n * Unless required by applicable law or agreed to in writing, software        *\n * distributed under the License is distributed on an "AS IS" BASIS,          *\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *\n * See the License for the specific language governing permissions and        *\n * limitations under the License.                                             *\n * -------------------------------------------------------------------------- */\n\n\n// INCLUDE\n#include "WrapObject.h"\n#include <string>\n#include <OpenSim/Simulation/osimSimulationDLL.h>\n#include <OpenSim/Common/Object.h>\n#include <OpenSim/Common/VisibleObject.h>\n#include <OpenSim/Common/PropertyDbl.h>\n#include "WrapObject.h"\n\nnamespace OpenSim {\n\nclass VisibleObject;\nclass Body;\nclass Model;\nclass PathPoint;\n * @author Peter Loan  \n * updated for OpenSim 4.0 by Benjamin Michaud, 2019.\n */\nclass OSIMSIMULATION_API WrapTorus : public WrapObject {\nOpenSim_DECLARE_CONCRETE_OBJECT(WrapTorus, WrapObject);\n\nprivate:\n    struct CircleCallback {\n        double p1[3], p2[3], r;\n    };\n\npublic:\n//==============================================================================\n// PROPERTIES\n//==============================================================================\n    OpenSim_DECLARE_PROPERTY(inner_radius, double, "The inner radius of the Torus.");\n    OpenSim_DECLARE_PROPERTY(outer_radius, double, "The outer radius of the Torus.");\n\n//=============================================================================\n// METHODS\n//=============================================================================\n    //--------------------------------------------------------------------------\n    // CONSTRUCTION\n    //--------------------------------------------------------------------------\npublic:\n    WrapTorus();\n    virtual ~WrapTorus();\n\n    const char* getWrapTypeName() const override;\n    std::string getDimensionsString() const override;\n    SimTK::Real getInnerRadius() const;\n    SimTK::Real getOuterRadius() const;\n\n    /** Scale the torus\'s dimensions. The base class (WrapObject) scales the\n        origin of the torus in the body\'s reference frame. */\n    void extendScale(const SimTK::State& s, const ScaleSet& scaleSet) override;\n\nprotected:\n    int wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2,\n        const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const override;\n\n    /// Implement generateDecorations to draw geometry in visualizer\n    void generateDecorations(bool fixed, const ModelDisplayHints& hints, const SimTK::State& state,\n        SimTK::Array_<SimTK::DecorativeGeometry>& appendToThis) const override;\n\n    void extendFinalizeFromProperties() override;\n\nprivate:\n    void constructProperties();\n\n    int findClosestPoint(double radius, double p1[], double p2[],\n        double* xc, double* yc, double* zc,\n        int wrap_sign, int wrap_axis) const;\n    static void calcCircleResids(int numResid, int numQs, double q[],\n        double resid[], int *flag2, void *ptr);\n\n//=============================================================================\n};  // END of class WrapTorus\n//=============================================================================\n//=============================================================================\n\n} // end of namespace OpenSim\n\n#endif // OPENSIM_WRAP_TORUS_H_\n\n\n', 'message': 'First commit to Geometry refactoring. Remove VisibleObject, DisplayGeometry and GeometrySet and all references to them. All test cases pass.\n\nConflicts:\n\tApplications/Scale/scale.cpp\n\tOpenSim/Actuators/McKibbenActuator.h\n\tOpenSim/Actuators/Test/testMuscles.cpp\n\tOpenSim/Common/DisplayGeometry.cpp\n\tOpenSim/Common/DisplayGeometry.h\n\tOpenSim/Common/Geometry.h\n\tOpenSim/Common/GeometrySet.h\n\tOpenSim/Common/Object.h\n\tOpenSim/Common/RegisterTypes_osimCommon.cpp\n\tOpenSim/Common/VisibleObject.cpp\n\tOpenSim/Common/VisibleObject.h\n\tOpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\n\tOpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.h\n\tOpenSim/Simulation/Model/ContactHalfSpace.cpp\n\tOpenSim/Simulation/Model/ContactMesh.cpp\n\tOpenSim/Simulation/Model/ContactSphere.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedBushingForce.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedBushingForce.h\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.h\n\tOpenSim/Simulation/Model/GeometryPath.cpp\n\tOpenSim/Simulation/Model/GeometryPath.h\n\tOpenSim/Simulation/Model/Ligament.cpp\n\tOpenSim/Simulation/Model/Ligament.h\n\tOpenSim/Simulation/Model/ModelVisualizer.cpp\n\tOpenSim/Simulation/Model/PathActuator.cpp\n\tOpenSim/Simulation/Model/PathActuator.h\n\tOpenSim/Simulation/Model/PathPoint.cpp\n\tOpenSim/Simulation/Model/PathPoint.h\n\tOpenSim/Simulation/Model/PathSpring.cpp\n\tOpenSim/Simulation/Model/PathSpring.h\n\tOpenSim/Simulation/Model/PointToPointSpring.cpp\n\tOpenSim/Simulation/Model/PointToPointSpring.h\n\tOpenSim/Simulation/SimbodyEngine/Body.cpp\n\tOpenSim/Simulation/SimbodyEngine/Body.h\n\tOpenSim/Simulation/Test/testProbes.cpp\n\tOpenSim/Simulation/Wrap/WrapCylinder.cpp\n\tOpenSim/Simulation/Wrap/WrapCylinderObst.cpp\n\tOpenSim/Simulation/Wrap/WrapDoubleCylinderObst.cpp\n\tOpenSim/Simulation/Wrap/WrapEllipsoid.cpp\n\tOpenSim/Simulation/Wrap/WrapObject.cpp\n\tOpenSim/Simulation/Wrap/WrapObject.h\n\tOpenSim/Simulation/Wrap/WrapSphere.cpp\n\tOpenSim/Simulation/Wrap/WrapSphereObst.cpp\n\tOpenSim/Simulation/Wrap/WrapTorus.cpp\n\tOpenSim/Wrapping/Python/OpenSimContext.h\n\nConflicts:\n\tOpenSim/Actuators/Test/testMuscles.cpp\n\tOpenSim/Common/Object.h\n\tOpenSim/Common/RegisterTypes_osimCommon.cpp\n\tOpenSim/Examples/CustomActuatorExample/toyLeg_example.cpp\n\tOpenSim/Examples/ExampleMain/OutputReference/TugOfWar_Complete.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.cpp\n\tOpenSim/Simulation/Model/ContactGeometry.h\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.cpp\n\tOpenSim/Simulation/Model/ExpressionBasedPointToPointForce.h\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.cpp\n\tOpenSim/Simulation/Model/FunctionBasedBushingForce.h\n\tOpenSim/Simulation/Model/GeometryPath.h\n\tOpenSim/Simulation/Model/PathActuator.cpp\n\tOpenSim/Simulation/Model/PathActuator.h\n\tOpenSim/Simulation/Model/PathPoint.cpp\n\tOpenSim/Simulation/Model/PathPoint.h\n\tOpenSim/Simulation/Model/PointToPointSpring.cpp\n\tOpenSim/Simulation/Model/PointToPointSpring.h\n\tOpenSim/Simulation/SimbodyEngine/Body.cpp\n\tOpenSim/Simulation/SimbodyEngine/Body.h\n\tOpenSim/Simulation/Wrap/WrapObject.cpp\n\tOpenSim/Simulation/Wrap/WrapObject.h\n', 'author_name': 'Ayman Habib', 'lang': 'h'}