Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
mydxfarc.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2010-2011,2014 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 
44 #ifndef MY_DXF_ARC_HPP
45 #define MY_DXF_ARC_HPP 1
46 
47 
48 #include "mydxfentities.hpp"
49 
50 
56 class MyDXFArc : public MyDXFPathEntity
57 {
58 
59  Vec3D _pc;
60  double _r;
61  double _ang1; // Must be between 0 and 2 pi.
62  double _ang2; // Must be between 0 and 2 pi.
63 
64 public:
65 
68  MyDXFArc() : _r(1.0), _ang1(0.0), _ang2(2.0*M_PI) {};
69 
72  MyDXFArc( class MyDXFFile *dxf );
73 
76  virtual ~MyDXFArc() {}
77 
80  virtual MyDXFArc *copy( void ) const { return( new MyDXFArc( *this ) ); }
81 
88  virtual void explode( class MyDXFEntities *ent, MyDXFFile *dxf, const Transformation *t ) const;
89 
92  virtual void write( class MyDXFFile *dxf, std::ofstream &ostr );
93 
96  virtual EntityType get_type( void ) const { return( ENTITY_ARC ); }
97 
100  Vec3D center( void ) const { return( _pc ); }
101 
104  double radius( void ) const { return( _r ); }
105 
108  virtual Vec3D start( void ) const {
109  return( Vec3D(_pc[0] + _r*cos(_ang1), _pc[1] + _r*sin(_ang1), _pc[2] ) );
110  }
111 
114  virtual Vec3D end( void ) const {
115  return( Vec3D(_pc[0] + _r*cos(_ang2), _pc[1] + _r*sin(_ang2), _pc[2] ) );
116  }
117 
120  void set_pc( const Vec3D &pc ) { _pc = pc; }
121 
124  void set_r( double r ) { _r = r; }
125 
128  void set_ang1( double ang1 );
129 
132  void set_ang2( double ang2 );
133 
136  double get_ang1( void ) const { return( _ang1 ); }
137 
140  double get_ang2( void ) const { return( _ang2 ); }
141 
146  void set_center_and_ends( const Vec3D &c, const Vec3D &s, const Vec3D &e );
147 
158  void set_center_point( const Vec3D &s, const Vec3D &e );
159 
162  virtual void set_start( const Vec3D &s );
163 
166  virtual void set_end( const Vec3D &e );
167 
176  virtual int ray_cross( double x, double y ) const;
177 
183  bool geom_same( const MyDXFArc &arc, double eps = 1.0e-6 ) const;
184 
192  virtual void plot( const class MyDXFFile *dxf, cairo_t *cairo,
193  const Transformation *t, const double range[4] ) const;
194 
197  virtual void get_bbox( Vec3D &min, Vec3D &max,
198  const class MyDXFFile *dxf, const Transformation *t ) const;
199 
202  virtual void scale( class MyDXFFile *dxf, double s );
203 
206  virtual void translate( class MyDXFFile *dxf, const Vec3D &dx );
207 
212  virtual void rotate_z( class MyDXFFile *dxf, double a );
213 
216  virtual void debug_print( std::ostream &os ) const;
217 };
218 
219 
220 #endif
221 
DXF arc entity class.
Definition: mydxfarc.hpp:57
virtual void set_end(const Vec3D &e)
Set end point of path entity.
Definition: mydxfarc.cpp:399
virtual void get_bbox(Vec3D &min, Vec3D &max, const class MyDXFFile *dxf, const Transformation *t) const
Return bounding box of entity.
Definition: mydxfarc.cpp:243
virtual Vec3D end(void) const
Get end point of path entity.
Definition: mydxfarc.hpp:114
virtual void set_start(const Vec3D &s)
Set start point of path entity.
Definition: mydxfarc.cpp:392
virtual void rotate_z(class MyDXFFile *dxf, double a)
Rotate entity around origin.
Definition: mydxfarc.cpp:287
virtual void plot(const class MyDXFFile *dxf, cairo_t *cairo, const Transformation *t, const double range[4]) const
Plot entity with cairo.
Definition: mydxfarc.cpp:159
virtual void translate(class MyDXFFile *dxf, const Vec3D &dx)
Translate entity by dx.
Definition: mydxfarc.cpp:281
virtual void scale(class MyDXFFile *dxf, double s)
Scale entity by factor s.
Definition: mydxfarc.cpp:274
virtual Vec3D start(void) const
Get start point of path entity.
Definition: mydxfarc.hpp:108
bool geom_same(const MyDXFArc &arc, double eps=1.0e-6) const
Check if two entities are geometrically same.
Definition: mydxfarc.cpp:383
void set_pc(const Vec3D &pc)
Set center point.
Definition: mydxfarc.hpp:120
virtual ~MyDXFArc()
Virtual destructor.
Definition: mydxfarc.hpp:76
virtual int ray_cross(double x, double y) const
Check for ray crossing.
Definition: mydxfarc.cpp:297
void set_center_point(const Vec3D &s, const Vec3D &e)
Set arc according to end points.
Definition: mydxfarc.cpp:423
void set_center_and_ends(const Vec3D &c, const Vec3D &s, const Vec3D &e)
Set arc according to center and end points.
Definition: mydxfarc.cpp:406
virtual void write(class MyDXFFile *dxf, std::ofstream &ostr)
Write dxf file to stream.
Definition: mydxfarc.cpp:144
void set_r(double r)
Set radius.
Definition: mydxfarc.hpp:124
void set_ang1(double ang1)
Set start angle.
Definition: mydxfarc.cpp:359
virtual void explode(class MyDXFEntities *ent, MyDXFFile *dxf, const Transformation *t) const
Explode into entities.
Definition: mydxfarc.cpp:101
double get_ang1(void) const
Get start angle.
Definition: mydxfarc.hpp:136
MyDXFArc()
Default constructor.
Definition: mydxfarc.hpp:68
virtual void debug_print(std::ostream &os) const
Print debugging information to stream os.
Definition: mydxfarc.cpp:373
virtual MyDXFArc * copy(void) const
Get a new copy of entity.
Definition: mydxfarc.hpp:80
virtual EntityType get_type(void) const
Get entity type.
Definition: mydxfarc.hpp:96
void set_ang2(double ang2)
Set end angle.
Definition: mydxfarc.cpp:366
double radius(void) const
Get radius of arc.
Definition: mydxfarc.hpp:104
double get_ang2(void) const
Get end angle.
Definition: mydxfarc.hpp:140
Vec3D center(void) const
Get center point of arc.
Definition: mydxfarc.hpp:100
DXF entity database.
Definition: mydxfentities.hpp:286
DXF file class.
Definition: mydxffile.hpp:70
DXF path entity base class.
Definition: mydxfentities.hpp:187
Transformation for homogenous three dimensional space.
Definition: transformation.hpp:70
Three dimensional vector.
Definition: vec3d.hpp:58
DXF Entities.
EntityType
Entity type.
Definition: mydxfentities.hpp:60


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.