Changeset 1323


Ignore:
Timestamp:
08/12/24 03:48:20 (2 months ago)
Author:
Maciej Komosinski
Message:

Field rename for less ambiguity

Location:
cpp/frams
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/shapeconvert.cpp

    r1118 r1323  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2024  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1515 @file
    1616 Sample code: Convert old-style shapes (sticks are Joints) to new style (sticks are Parts)
    17  Usage: shapeconvert [-sSHAPE] [-tTHICKNESS] [genotype_or_stdin]
     17 Usage: shapeconvert [-sSHAPE] [-rRADIUS] [genotype_or_stdin]
    1818
    1919 Calling examples:
     
    3838        PreconfiguredGenetics genetics;
    3939        Part::Shape shape = Part::SHAPE_CYLINDER;
    40         float thickness = Part::DEFAULT_STICK_RADIUS;
     40        float radius = Part::BALL_AND_STICK_RADIUS;
    4141
    4242        char* gen_arg = 0;
     
    5454                                }
    5555                                break;
    56                         case 't': thickness = atof(ar + 2); break;
    57                         case 'h': puts("Usage: shapeconvert [-sSHAPE] [-tTHICKNESS] [genotype_or_stdin]\n\tSHAPE: 1=ellipsoid, 2=cuboid, 3(default)=cylinder\n\tTHICKNESS: used for Part.sy/sz (default=0.2)"); break;
     56                        case 'r': radius = atof(ar + 2); break;
     57                        case 'h': puts("Usage: shapeconvert [-sSHAPE] [-rRADIUS] [genotype_or_stdin]\n\tSHAPE: 1=ellipsoid, 2=cuboid, 3(default)=cylinder\n\tRADIUS: used for Part.sy/sz (default=0.2)"); break;
    5858                        }
    5959                else
     
    8383        Model newmodel;
    8484        newmodel.open();
    85         newmodel.buildUsingSolidShapeTypes(m, shape, thickness);
     85        newmodel.buildUsingSolidShapeTypes(m, shape, radius);
    8686        newmodel.close();
    8787
  • cpp/frams/model/model.cpp

    r1286 r1323  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2023  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2024  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    12891289}
    12901290
    1291 void Model::buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape, double thickness)
     1291void Model::buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape, double radius)
    12921292{
    12931293        for (int i = 0; i < src_ballandstick_shapes.getJointCount(); i++)
     
    13001300                p->setRot(o.getAngles());
    13011301                p->scale.x = oj->part1->p.distanceTo(oj->part2->p) / 2;
    1302                 p->scale.y = thickness;
    1303                 p->scale.z = thickness;
     1302                p->scale.y = radius;
     1303                p->scale.z = radius;
    13041304        }
    13051305        if (src_ballandstick_shapes.getJointCount() == 0) //single part "ball-and-stick" models are valid so let's make a valid solid shape model
     
    13101310                        p->p = op->p;
    13111311                        p->rot = op->rot;
    1312                         p->scale.x = p->scale.y = p->scale.z = thickness;
     1312                        p->scale.x = p->scale.y = p->scale.z = radius;
    13131313                }
    13141314        for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++)
     
    13341334}
    13351335
    1336 SolidsShapeTypeModel::SolidsShapeTypeModel(Model &m, Part::Shape use_shape, double thickness)
     1336SolidsShapeTypeModel::SolidsShapeTypeModel(Model &m, Part::Shape use_shape, double radius)
    13371337{
    13381338        using_model = converted_model = NULL;
     
    13411341                converted_model = new Model;
    13421342                converted_model->open();
    1343                 converted_model->buildUsingSolidShapeTypes(m, use_shape, thickness);
     1343                converted_model->buildUsingSolidShapeTypes(m, use_shape, radius);
    13441344                converted_model->close();
    13451345                using_model = converted_model;
  • cpp/frams/model/model.h

    r1130 r1323  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2024  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    390390
    391391        /// build this model using solid shape types, based on the provided ball-and-stick model. See also shapeconvert.cpp.
    392         void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = Part::DEFAULT_STICK_RADIUS);
     392        void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double radius = Part::BALL_AND_STICK_RADIUS);
    393393
    394394protected:
     
    443443        Model *converted_model;
    444444        Model *using_model;
    445         SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = Part::DEFAULT_STICK_RADIUS);
     445        SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double radius = Part::BALL_AND_STICK_RADIUS);
    446446        operator Model &() { return *using_model; }
    447447        Model &getModel() { return *using_model; }
  • cpp/frams/model/modelparts.h

    r1318 r1323  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2024  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    103103        };
    104104        static const char* getShapeName(Shape sh);
    105         static constexpr double DEFAULT_STICK_RADIUS = 0.15; //used in odesim, VisualModel, CreatureObj3D, and SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion
     105        static constexpr double BALL_AND_STICK_RADIUS = 0.15; //used in odesim, VisualModel, CreatureObj3D, and SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion
    106106
    107107        double mass, size, density, friction, ingest, assim, hollow;
Note: See TracChangeset for help on using the changeset viewer.