H3D API  2.4.1
ArcClose2D.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __ARCCLOSE2D_H__
30 #define __ARCCLOSE2D_H__
31 
32 #include <H3D/X3DGeometryNode.h>
33 #include <H3D/SFFloat.h>
34 #include <H3D/SFString.h>
35 
36 namespace H3D {
37 
66 
67  class H3DAPI_API ArcClose2D :
68  public X3DGeometryNode {
69  public:
70 
76  class SFBound: public TypedField< X3DGeometryNode::SFBound,
77  SFFloat > {
79  virtual void update() {
80  H3DFloat d = 2 * static_cast< SFFloat * >( routes_in[0] )->getValue();
81  BoxBound *bb = new BoxBound;
82  bb->size->setValue( Vec3f( d, d, 0.f ) );
83  value = bb;
84  }
85  };
86 
88  ArcClose2D( Inst< SFNode > _metadata = 0,
89  Inst< SFBound > _bound = 0,
90  Inst< DisplayList > _displayList = 0,
91  Inst< MFBool > _isTouched = 0,
92  Inst< MFVec3f > _force = 0,
93  Inst< MFVec3f > _contactPoint = 0,
94  Inst< MFVec3f > _contactNormal = 0,
95  Inst< SFFloat > _endAngle = 0,
96  Inst< SFFloat > _startAngle = 0,
97  Inst< SFFloat > _radius = 0,
98  Inst< SFString > _closureType = 0,
99  Inst< SFBool > _solid = 0 );
100 
102  virtual void render();
103 
105  virtual int nrTriangles() {
106  return 40;
107  }
108 
109  // Traverse the scenegraph. See X3DGeometryNode::traverseSG
110  // for more info.
111  virtual void traverseSG( TraverseInfo &ti );
112 
120  H3DUniquePtr< SFFloat > endAngle;
121 
129  H3DUniquePtr< SFFloat > startAngle;
130 
138  H3DUniquePtr< SFFloat > radius;
139 
150  H3DUniquePtr< SFString > closureType;
151 
152 
160  H3DUniquePtr< SFBool > solid;
161 
164  };
165 }
166 
167 #endif
Contains the SFFloat field class.
Contains the SFString field class.
Header file for X3DGeometryNode, X3D scene-graph node.
SFBound is specialized update itself from the radius field of the Box node.
Definition: ArcClose2D.h:77
The ArcClose node specifies a portion of a circle whose center is at (0,0) and whose angles are measu...
Definition: ArcClose2D.h:68
H3DUniquePtr< SFBool > solid
The solid field specifies if both sides of the closed arc should be rendered.
Definition: ArcClose2D.h:160
virtual int nrTriangles()
The number of triangles rendered by this geometry.
Definition: ArcClose2D.h:105
H3DUniquePtr< SFFloat > endAngle
The end angle for the ArcClose.
Definition: ArcClose2D.h:120
H3DUniquePtr< SFFloat > startAngle
The start angle for the ArcClose.
Definition: ArcClose2D.h:129
H3DUniquePtr< SFString > closureType
A closureType of "PIE" connects the end point to the start point by defining two straight line segmen...
Definition: ArcClose2D.h:150
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: ArcClose2D.h:163
H3DUniquePtr< SFFloat > radius
The radius field specifies the radius of the circle of which the ArcClose is a portion.
Definition: ArcClose2D.h:138
The BoxBound is a Bound class that specifies the bound using an axis-aligned bounding box.
Definition: Bound.h:144
H3DUniquePtr< SFVec3f > size
The size of the bounding box.
Definition: Bound.h:287
The SFFloat field contains one single-precision floating point number.
Definition: SFFloat.h:41
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
A template modifier class for adding type checking on the routes to any Field class.
Definition: TypedField.h:84
This is the base node type for all geometry in X3D.
Definition: X3DGeometryNode.h:61
float H3DFloat
Type getValue(const char *s, const char *&rest)
Function that reads characters from a char * and converts them to a given type.
Definition: X3DFieldConversion.h:134
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194