mbsim  4.0.0
MBSim Kernel
cuboid.h
1/* Copyright (C) 2004-2009 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: martin.o.foerg@googlemail.com
18 */
19
20#ifndef _CUBOID_H_
21#define _CUBOID_H_
22
23#include "mbsim/contours/compound_contour.h"
24#include "mbsim/utils/boost_parameters.h"
25#include "mbsim/utils/openmbv_utils.h"
26#include <openmbvcppinterface/cuboid.h>
27
28namespace MBSim {
29
33 class Cuboid : public CompoundContour {
34 public:
41 Cuboid(const std::string &name="", const fmatvec::Vec3 &length=fmatvec::Vec3(fmatvec::INIT,1), Frame *R=nullptr) : CompoundContour(name,R), lx(length(0)), ly(length(1)), lz(length(2)) { }
42
43 /* INHERITED INTERFACE OF ELEMENT */
44 /***************************************************/
45 void initializeUsingXML(xercesc::DOMElement *element) override;
46 void init(InitStage stage, const InitConfigSet &config) override;
47 /***************************************************/
48
49 /* GETTER / SETTER */
50 void setLength(const fmatvec::Vec3 &length) { lx = length(0); ly = length(1); lz = length(2); }
51 void setLength(double lx_, double ly_, double lz_) { lx = lx_; ly = ly_; lz = lz_; }
52 /***************************************************/
53
54 BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, tag, (optional (diffuseColor,(const fmatvec::Vec3&),fmatvec::Vec3(std::vector<double>{-1,1,1}))(transparency,(double),0)(pointSize,(double),0)(lineWidth,(double),0))) {
55 OpenMBVColoredBody ombv(diffuseColor,transparency,pointSize,lineWidth);
56 openMBVRigidBody=ombv.createOpenMBV<OpenMBV::Cuboid>();
57 }
58
59 private:
63 double lx{1};
64 double ly{1};
65 double lz{1};
66 };
67}
68
69#endif /* _CUBOID_H_ */
contour consisting of primitive contour elements
Definition: compound_contour.h:34
std::vector< RigidContour * > element
list of all subelements
Definition: compound_contour.h:69
Cuboid with 8 vertices, 12 edges and 6 faces.
Definition: cuboid.h:33
double lx
x-, y- and z-length of cuboid
Definition: cuboid.h:63
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: cuboid.cc:39
Cuboid(const std::string &name="", const fmatvec::Vec3 &length=fmatvec::Vec3(fmatvec::INIT, 1), Frame *R=nullptr)
constructor
Definition: cuboid.h:41
InitStage
The stages of the initialization.
Definition: element.h:62
std::string name
name of element
Definition: element.h:260
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
Frame * R
coordinate system of contour
Definition: rigid_contour.h:135
namespace MBSim
Definition: bilateral_constraint.cc:30