g4tools  5.4.0
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
tools::sg::markers Class Reference
Inheritance diagram for tools::sg::markers:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::markers:
Collaboration graph
[legend]

Public Member Functions

virtual const desc_fieldsnode_desc_fields () const
 
virtual bool draw_in_frame_buffer () const
 
virtual void render (render_action &a_action)
 
virtual void pick (pick_action &a_action)
 
virtual void bbox (bbox_action &a_action)
 
 markers ()
 
virtual ~markers ()
 
 markers (const markers &a_from)
 
markersoperator= (const markers &a_from)
 
template<class VEC >
void add (const VEC &a_v)
 
void add (float a_x, float a_y, float a_z)
 
bool add (const std::vector< float > &a_v)
 
size_t number () const
 
void clear ()
 
- Public Member Functions inherited from tools::sg::node
virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const =0
 
virtual nodecopy () const =0
 
virtual unsigned int cls_version () const
 
virtual void search (search_action &a_action)
 
virtual void get_matrix (get_matrix_action &a_action)
 
virtual bool write (write_action &a_action)
 
virtual void event (event_action &)
 
virtual bool read (read_action &a_action)
 
virtual void is_visible (visible_action &)
 
virtual void protocol_one_fields (std::vector< field * > &a_fields) const
 
virtual bool touched ()
 
virtual void reset_touched ()
 
 node ()
 
virtual ~node ()
 
void touch ()
 
fieldfield_from_desc (const field_desc &a_desc) const
 
void dump_field_descs (std::ostream &a_out) const
 
fieldfind_field_by_name (const std::string &a_name) const
 

Public Attributes

sf_enum< marker_stylestyle
 
mf< float > xyzs
 
sf< float > size
 

Protected Member Functions

void _add (std::vector< float > &a_v, float a_x, float a_y, float a_z)
 
- Protected Member Functions inherited from tools::sg::node
 node (const node &)
 
nodeoperator= (const node &)
 
void add_field (field *a_field)
 
bool write_fields (write_action &a_action)
 
bool read_fields (read_action &a_action)
 
field_desc::offset_t field_offset (const field *a_field) const
 
fieldfind_field (const field_desc &a_rdesc) const
 
void check_fields (std::ostream &a_out) const
 

Detailed Description

Definition at line 21 of file markers.

Constructor & Destructor Documentation

◆ markers() [1/2]

tools::sg::markers::markers ( )
inline

Definition at line 558 of file markers.

559  :parent()
561  ,size(10)
562  {
563 #ifdef TOOLS_MEM
564  mem::increment(s_class().c_str());
565 #endif
566  add_fields();
567  }

◆ ~markers()

virtual tools::sg::markers::~markers ( )
inlinevirtual

Definition at line 568 of file markers.

568  {
569 #ifdef TOOLS_MEM
570  mem::decrement(s_class().c_str());
571 #endif
572  }

◆ markers() [2/2]

tools::sg::markers::markers ( const markers a_from)
inline

Definition at line 574 of file markers.

575  :parent(a_from)
576  ,style(a_from.style)
577  ,xyzs(a_from.xyzs)
578  ,size(a_from.size)
579  {
580 #ifdef TOOLS_MEM
581  mem::increment(s_class().c_str());
582 #endif
583  add_fields();
584  }

Member Function Documentation

◆ _add()

void tools::sg::markers::_add ( std::vector< float > &  a_v,
float  a_x,
float  a_y,
float  a_z 
)
inlineprotected

Definition at line 618 of file markers.

618  {
619  a_v.push_back(a_x);
620  a_v.push_back(a_y);
621  a_v.push_back(a_z);
622  }

◆ add() [1/3]

bool tools::sg::markers::add ( const std::vector< float > &  a_v)
inline

Definition at line 604 of file markers.

604  {
605  std::vector<float>::size_type _number = a_v.size()/3;
606  if(3*_number!=a_v.size()) return false;
607  std::vector<float>::const_iterator it;
608  for(it=a_v.begin();it!=a_v.end();it+=3) {
609  xyzs.add(*(it+0));
610  xyzs.add(*(it+1));
611  xyzs.add(*(it+2));
612  }
613  return true;
614  }

◆ add() [2/3]

template<class VEC >
void tools::sg::markers::add ( const VEC &  a_v)
inline

Definition at line 594 of file markers.

594  {
595  xyzs.add(a_v.x());
596  xyzs.add(a_v.y());
597  xyzs.add(a_v.z());
598  }

◆ add() [3/3]

void tools::sg::markers::add ( float  a_x,
float  a_y,
float  a_z 
)
inline

Definition at line 599 of file markers.

599  {
600  xyzs.add(a_x);
601  xyzs.add(a_y);
602  xyzs.add(a_z);
603  }

◆ bbox()

virtual void tools::sg::markers::bbox ( bbox_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 546 of file markers.

546  {
547  const std::vector<float>& _xyzs = xyzs.values();
548  float x,y,z;
549  std::vector<float>::const_iterator it;
550  for(it=_xyzs.begin();it!=_xyzs.end();){
551  x = *it;it++;
552  y = *it;it++;
553  z = *it;it++;
554  a_action.add_one_point(x,y,z);
555  }
556  }

◆ clear()

void tools::sg::markers::clear ( )
inline

Definition at line 616 of file markers.

616 {xyzs.clear();}

◆ draw_in_frame_buffer()

virtual bool tools::sg::markers::draw_in_frame_buffer ( ) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 44 of file markers.

44 {return true;}

◆ node_desc_fields()

virtual const desc_fields& tools::sg::markers::node_desc_fields ( ) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 28 of file markers.

28  {
30  static const desc_fields s_v(parent::node_desc_fields(),3, //WARNING : take care of count.
34  );
35  return s_v;
36  }

◆ number()

size_t tools::sg::markers::number ( ) const
inline

Definition at line 615 of file markers.

615 {return xyzs.size()/3;}

◆ operator=()

markers& tools::sg::markers::operator= ( const markers a_from)
inline

Definition at line 585 of file markers.

585  {
586  parent::operator=(a_from);
587  style = a_from.style;
588  xyzs = a_from.xyzs;
589  size = a_from.size;
590  return *this;
591  }

◆ pick()

virtual void tools::sg::markers::pick ( pick_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 509 of file markers.

509  {
510  size_t num = xyzs.size()/3;
511  if(!num) return;
512 
513  state& state = a_action.state();
514 
515  const std::vector<float>& _xyzs = xyzs.values();
516 
517  std::vector<float> pts;
518 
519  float sx = size.value()/float(state.m_ww); //in [-1,1]
520  float hsx = sx*0.5f;
521 
522  float sy = size.value()/float(state.m_wh); //in [-1,1]
523  float hsy = sy*0.5f;
524 
525  float x,y,z,w;
526 
527  std::vector<float>::const_iterator it;
528  for(it=_xyzs.begin();it!=_xyzs.end();){
529  x = *it;it++;
530  y = *it;it++;
531  z = *it;it++;
532 
533  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
534 
535  _add(pts, x-hsx,y-hsy,z); //in [-1,1][-1,1]
536  _add(pts, x+hsx,y+hsy,z);
537  _add(pts, x+hsx,y-hsy,z);
538  _add(pts, x-hsx,y+hsy,z);
539  }
540 
541  a_action.set_matrices_to_identity();
542  a_action.add__lines(*this,pts);
543  a_action.set_matrices_from_state();
544  }

◆ render()

virtual void tools::sg::markers::render ( render_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 46 of file markers.

46  {
47  size_t num = xyzs.size()/3;
48  if(!num) return;
49 
50  //NOTE : gstos would not work because of project_point() that must be done at each render().
51 
52  const state& state = a_action.state();
53 
54  const std::vector<float>& _xyzs = xyzs.values();
55 
56  std::vector<float> pts;
57 
58  float sx = size.value()/float(state.m_ww); //in [-1,1]
59  float hsx = sx*0.5f;
60 
61  float sy = size.value()/float(state.m_wh); //in [-1,1]
62  float hsy = sy*0.5f;
63 
64  float rad = hsx;
65  float hsx2 = hsx*0.5f;
66  float hsy2 = hsy*0.5f;
67 
68  float x,y,z,w;
69 
70  bool filled = false;
72  unsigned int segs = 16;
73  float _cos[16];float _sin[16];
74  float dtheta = ftwo_pi()/float(segs);
75  float theta = dtheta;
76  {for(unsigned int i=0;i<segs;i++,theta+=dtheta) {_cos[i] = rad*fcos(theta);_sin[i] = rad*fsin(theta);}}
77  float xprev,yprev,xnext,ynext;
78  std::vector<float>::const_iterator it;
79  for(it=_xyzs.begin();it!=_xyzs.end();){
80  x = *it;it++;
81  y = *it;it++;
82  z = *it;it++;
83  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
84  xprev = x+rad;
85  yprev = y;
86  for(unsigned int i=0;i<segs;i++) {
87  xnext = x+_cos[i];
88  ynext = y+_sin[i];
89  _add(pts,xprev,yprev,z);
90  _add(pts,xnext,ynext,z);
91  xprev = xnext;
92  yprev = ynext;
93  }
94  }
95 
96  } else if(style.value()==marker_circle_filled) {
97  //} else if((style.value()==marker_circle_filled)||(style.value()==marker_dot)) {
98  filled = true;
99  unsigned int segs = 16;
100  float _cos[16];float _sin[16];
101  float dtheta = ftwo_pi()/float(segs);
102  float theta = dtheta;
103  {for(unsigned int i=0;i<segs;i++,theta+=dtheta) {_cos[i] = rad*fcos(theta);_sin[i] = rad*fsin(theta);}}
104  float xprev,yprev,xnext,ynext;
105  std::vector<float>::const_iterator it;
106  for(it=_xyzs.begin();it!=_xyzs.end();){
107  x = *it;it++;
108  y = *it;it++;
109  z = *it;it++;
110  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
111  xprev = x+rad;
112  yprev = y;
113  for(unsigned int i=0;i<segs;i++) {
114  xnext = x+_cos[i];
115  ynext = y+_sin[i];
116  _add(pts,x ,y ,z);
117  _add(pts,xprev,yprev,z);
118  _add(pts,xnext,ynext,z);
119  xprev = xnext;
120  yprev = ynext;
121  }
122  }
123 
124  } else if(style.value()==marker_square_line) {
125  std::vector<float>::const_iterator it;
126  for(it=_xyzs.begin();it!=_xyzs.end();){
127  x = *it;it++;
128  y = *it;it++;
129  z = *it;it++;
130  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
131  _add(pts, x-hsx,y-hsy,z);
132  _add(pts, x+hsx,y-hsy,z);
133 
134  _add(pts, x+hsx,y-hsy,z);
135  _add(pts, x+hsx,y+hsy,z);
136 
137  _add(pts, x+hsx,y+hsy,z);
138  _add(pts, x-hsx,y+hsy,z);
139 
140  _add(pts, x-hsx,y+hsy,z);
141  _add(pts, x-hsx,y-hsy,z);
142  }
143  //} else if(style.value()==marker_square_filled) {
144  } else if((style.value()==marker_square_filled)||(style.value()==marker_dot)) {
145  filled = true;
146  std::vector<float>::const_iterator it;
147  for(it=_xyzs.begin();it!=_xyzs.end();){
148  x = *it;it++;
149  y = *it;it++;
150  z = *it;it++;
151  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
152  _add(pts, x-hsx,y-hsy,z);
153  _add(pts, x+hsx,y-hsy,z);
154  _add(pts, x+hsx,y+hsy,z);
155 
156  _add(pts, x-hsx,y-hsy,z);
157  _add(pts, x+hsx,y+hsy,z);
158  _add(pts, x-hsx,y+hsy,z);
159  }
160 
161  } else if(style.value()==marker_triangle_up_line) {
162  std::vector<float>::const_iterator it;
163  for(it=_xyzs.begin();it!=_xyzs.end();){
164  x = *it;it++;
165  y = *it;it++;
166  z = *it;it++;
167  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
168  _add(pts, x-hsx,y-hsy,z);
169  _add(pts, x+hsx,y-hsy,z);
170 
171  _add(pts, x+hsx,y-hsy,z);
172  _add(pts, x ,y+hsy,z);
173 
174  _add(pts, x ,y+hsy,z);
175  _add(pts, x-hsx,y-hsy,z);
176  }
177  } else if(style.value()==marker_triangle_up_filled) {
178  filled = true;
179  std::vector<float>::const_iterator it;
180  for(it=_xyzs.begin();it!=_xyzs.end();){
181  x = *it;it++;
182  y = *it;it++;
183  z = *it;it++;
184  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
185  _add(pts, x-hsx,y-hsy,z);
186  _add(pts, x+hsx,y-hsy,z);
187  _add(pts, x ,y+hsy,z);
188  }
189 
190  } else if(style.value()==marker_triangle_down_line) {
191  std::vector<float>::const_iterator it;
192  for(it=_xyzs.begin();it!=_xyzs.end();){
193  x = *it;it++;
194  y = *it;it++;
195  z = *it;it++;
196  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
197  _add(pts, x-hsx,y+hsy,z);
198  _add(pts, x ,y-hsy,z);
199 
200  _add(pts, x ,y-hsy,z);
201  _add(pts, x+hsx,y+hsy,z);
202 
203  _add(pts, x+hsx,y+hsy,z);
204  _add(pts, x-hsx,y+hsy,z);
205  }
206  } else if(style.value()==marker_triangle_down_filled) {
207  filled = true;
208  std::vector<float>::const_iterator it;
209  for(it=_xyzs.begin();it!=_xyzs.end();){
210  x = *it;it++;
211  y = *it;it++;
212  z = *it;it++;
213  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
214  _add(pts, x-hsx,y+hsy,z);
215  _add(pts, x ,y-hsy,z);
216  _add(pts, x+hsx,y+hsy,z);
217  }
218 
219  } else if(style.value()==marker_diamond_line) {
220  std::vector<float>::const_iterator it;
221  for(it=_xyzs.begin();it!=_xyzs.end();){
222  x = *it;it++;
223  y = *it;it++;
224  z = *it;it++;
225  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
226  _add(pts, x ,y-hsy,z);
227  _add(pts, x+hsx, y,z);
228 
229  _add(pts, x+hsx, y,z);
230  _add(pts, x ,y+hsy,z);
231 
232  _add(pts, x ,y+hsy,z);
233  _add(pts, x-hsx,y ,z);
234 
235  _add(pts, x-hsx,y ,z);
236  _add(pts, x ,y-hsy,z);
237  }
238  } else if(style.value()==marker_diamond_filled) {
239  filled = true;
240  std::vector<float>::const_iterator it;
241  for(it=_xyzs.begin();it!=_xyzs.end();){
242  x = *it;it++;
243  y = *it;it++;
244  z = *it;it++;
245  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
246  _add(pts, x ,y-hsy,z);
247  _add(pts, x+hsx, y,z);
248  _add(pts, x ,y+hsy,z);
249 
250  _add(pts, x ,y+hsy,z);
251  _add(pts, x-hsx,y ,z);
252  _add(pts, x ,y-hsy,z);
253  }
254 
255  } else if(style.value()==marker_swiss_cross_line) {
256  std::vector<float>::const_iterator it;
257  for(it=_xyzs.begin();it!=_xyzs.end();){
258  x = *it;it++;
259  y = *it;it++;
260  z = *it;it++;
261  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
262  _add(pts, x-hsx2,y-hsy,z);
263  _add(pts, x+hsx2,y-hsy,z);
264 
265  _add(pts, x+hsx2,y-hsy ,z);
266  _add(pts, x+hsx2,y-hsy2,z);
267 
268  _add(pts, x+hsx2,y-hsy2,z);
269  _add(pts, x+hsx ,y-hsy2,z);
270 
271  _add(pts, x+hsx ,y-hsy2,z);
272  _add(pts, x+hsx ,y+hsy2,z);
273 
274  _add(pts, x+hsx ,y+hsy2,z);
275  _add(pts, x+hsx2,y+hsy2,z);
276 
277  _add(pts, x+hsx2,y+hsy2,z);
278  _add(pts, x+hsx2,y+hsy ,z);
279 
280  _add(pts, x+hsx2,y+hsy ,z);
281  _add(pts, x-hsx2,y+hsy ,z);
282 
283  _add(pts, x-hsx2,y+hsy ,z);
284  _add(pts, x-hsx2,y+hsy2,z);
285 
286  _add(pts, x-hsx2,y+hsy2,z);
287  _add(pts, x-hsx ,y+hsy2,z);
288 
289  _add(pts, x-hsx ,y+hsy2,z);
290  _add(pts, x-hsx ,y-hsy2,z);
291 
292  _add(pts, x-hsx ,y-hsy2,z);
293  _add(pts, x-hsx2,y-hsy2,z);
294 
295  _add(pts, x-hsx2,y-hsy2,z);
296  _add(pts, x-hsx2,y-hsy, z);
297  }
298  } else if(style.value()==marker_swiss_cross_filled) {
299  filled = true;
300  std::vector<float>::const_iterator it;
301  for(it=_xyzs.begin();it!=_xyzs.end();){
302  x = *it;it++;
303  y = *it;it++;
304  z = *it;it++;
305  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
306  _add(pts, x-hsx2,y-hsy,z);
307  _add(pts, x+hsx2,y-hsy,z);
308  _add(pts, x+hsx2,y+hsy,z);
309 
310  _add(pts, x+hsx2,y+hsy,z);
311  _add(pts, x-hsx2,y+hsy,z);
312  _add(pts, x-hsx2,y-hsy,z);
313 
314  _add(pts, x-hsx ,y-hsy2,z);
315  _add(pts, x+hsx ,y-hsy2,z);
316  _add(pts, x+hsx ,y+hsy2,z);
317 
318  _add(pts, x+hsx ,y+hsy2,z);
319  _add(pts, x-hsx ,y+hsy2,z);
320  _add(pts, x-hsx ,y-hsy2,z);
321  }
322 
323  } else if(style.value()==marker_david_star_line) {
324  std::vector<float>::const_iterator it;
325  for(it=_xyzs.begin();it!=_xyzs.end();){
326  x = *it;it++;
327  y = *it;it++;
328  z = *it;it++;
329  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
330  _add(pts, x-hsx,y-hsy2,z);
331  _add(pts, x+hsx,y-hsy2,z);
332 
333  _add(pts, x+hsx,y-hsy2,z);
334  _add(pts, x ,y+hsy ,z);
335 
336  _add(pts, x ,y+hsy ,z);
337  _add(pts, x-hsx,y-hsy2,z);
338 
339  _add(pts, x+hsx,y+hsy2,z);
340  _add(pts, x-hsx,y+hsy2,z);
341 
342  _add(pts, x-hsx,y+hsy2,z);
343  _add(pts, x ,y-hsy ,z);
344 
345  _add(pts, x ,y-hsy ,z);
346  _add(pts, x+hsx,y+hsy2,z);
347  }
348  } else if(style.value()==marker_david_star_filled) {
349  filled = true;
350  std::vector<float>::const_iterator it;
351  for(it=_xyzs.begin();it!=_xyzs.end();){
352  x = *it;it++;
353  y = *it;it++;
354  z = *it;it++;
355  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
356  _add(pts, x-hsx,y-hsy2,z);
357  _add(pts, x+hsx,y-hsy2,z);
358  _add(pts, x ,y+hsy ,z);
359 
360  _add(pts, x+hsx,y+hsy2,z);
361  _add(pts, x-hsx,y+hsy2,z);
362  _add(pts, x ,y-hsy ,z);
363  }
364 
365  } else if(style.value()==marker_penta_star_line) {
366  float _cos[5];float _sin[5];
367  float dtheta = ftwo_pi()/5.0f;
368  float theta = fhalf_pi();
369  {for(unsigned int i=0;i<5;i++,theta+=dtheta) {_cos[i] = rad*fcos(theta);_sin[i] = rad*fsin(theta);}}
370  std::vector<float>::const_iterator it;
371  for(it=_xyzs.begin();it!=_xyzs.end();){
372  x = *it;it++;
373  y = *it;it++;
374  z = *it;it++;
375  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
376  _add(pts, x+_cos[0],y+_sin[0] ,z);
377  _add(pts, x+_cos[2],y+_sin[2] ,z);
378 
379  _add(pts, x+_cos[2],y+_sin[2] ,z);
380  _add(pts, x+_cos[4],y+_sin[4] ,z);
381 
382  _add(pts, x+_cos[4],y+_sin[4] ,z);
383  _add(pts, x+_cos[1],y+_sin[1] ,z);
384 
385  _add(pts, x+_cos[1],y+_sin[1] ,z);
386  _add(pts, x+_cos[3],y+_sin[3] ,z);
387 
388  _add(pts, x+_cos[3],y+_sin[3] ,z);
389  _add(pts, x+_cos[0],y+_sin[0] ,z);
390  }
391  } else if(style.value()==marker_penta_star_filled) {
392  filled = true;
393  float _cos[5];float _sin[5];
394  float dtheta = ftwo_pi()/5.0f;
395  float theta = fhalf_pi();
396  {for(unsigned int i=0;i<5;i++,theta+=dtheta) {_cos[i] = rad*fcos(theta);_sin[i] = rad*fsin(theta);}}
397  vec2f i3;
398  {vec2f p1(_cos[2],_sin[2]);
399  vec2f q1(_cos[4],_sin[4]);
400  vec2f p2(_cos[3],_sin[3]);
401  vec2f q2(_cos[0],_sin[0]);
402  if(!intersect(p1,q1,p2,q2,i3)) {}}
403  vec2f i4;
404  {vec2f p1(_cos[1],_sin[1]);
405  vec2f q1(_cos[4],_sin[4]);
406  vec2f p2(_cos[3],_sin[3]);
407  vec2f q2(_cos[0],_sin[0]);
408  if(!intersect(p1,q1,p2,q2,i4)) {}}
409  vec2f i0;
410  {vec2f p1(_cos[1],_sin[1]);
411  vec2f q1(_cos[4],_sin[4]);
412  vec2f p2(_cos[0],_sin[0]);
413  vec2f q2(_cos[2],_sin[2]);
414  if(!intersect(p1,q1,p2,q2,i0)) {}}
415  std::vector<float>::const_iterator it;
416  for(it=_xyzs.begin();it!=_xyzs.end();){
417  x = *it;it++;
418  y = *it;it++;
419  z = *it;it++;
420  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
421  _add(pts, x+_cos[0],y+_sin[0] ,z);
422  _add(pts, x+_cos[2],y+_sin[2] ,z);
423  _add(pts, x+ i3.x(),y+ i3.y() ,z);
424 
425  _add(pts, x+_cos[1],y+_sin[1] ,z);
426  _add(pts, x+_cos[3],y+_sin[3] ,z);
427  _add(pts, x+ i4.x(),y+ i4.y() ,z);
428 
429  _add(pts, x+ i0.x(),y+ i0.y() ,z);
430  _add(pts, x+_cos[2],y+_sin[2] ,z);
431  _add(pts, x+_cos[4],y+_sin[4] ,z);
432  }
433 
434  } else if(style.value()==marker_plus) {
435  std::vector<float>::const_iterator it;
436  for(it=_xyzs.begin();it!=_xyzs.end();){
437  x = *it;it++;
438  y = *it;it++;
439  z = *it;it++;
440  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
441  _add(pts, x-hsx,y,z);
442  _add(pts, x+hsx,y,z);
443  _add(pts, x ,y-hsy,z);
444  _add(pts, x ,y+hsy,z);
445  }
446  } else if(style.value()==marker_asterisk) {
447  std::vector<float>::const_iterator it;
448  for(it=_xyzs.begin();it!=_xyzs.end();){
449  x = *it;it++;
450  y = *it;it++;
451  z = *it;it++;
452  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
453  _add(pts, x ,y-hsy ,z);
454  _add(pts, x ,y+hsy ,z);
455  _add(pts, x-hsx,y-hsy2,z);
456  _add(pts, x+hsx,y+hsy2,z);
457  _add(pts, x-hsx,y+hsy2,z);
458  _add(pts, x+hsx,y-hsy2,z);
459  }
460  } else if(style.value()==marker_star) {
461  std::vector<float>::const_iterator it;
462  for(it=_xyzs.begin();it!=_xyzs.end();){
463  x = *it;it++;
464  y = *it;it++;
465  z = *it;it++;
466  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
467  _add(pts, x ,y-hsy ,z);
468  _add(pts, x ,y+hsy ,z);
469  _add(pts, x-hsx,y-hsy2,z);
470  _add(pts, x+hsx,y+hsy2,z);
471  _add(pts, x-hsx,y+hsy2,z);
472  _add(pts, x+hsx,y-hsy2,z);
473  _add(pts, x-hsx,y ,z);
474  _add(pts, x+hsx,y ,z);
475  }
476  } else if(style.value()==marker_minus) {
477  std::vector<float>::const_iterator it;
478  for(it=_xyzs.begin();it!=_xyzs.end();){
479  x = *it;it++;
480  y = *it;it++;
481  z = *it;it++;
482  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
483  _add(pts, x-hsx,y,z);
484  _add(pts, x+hsx,y,z);
485  }
486  } else { //marker_cross.
487  std::vector<float>::const_iterator it;
488  for(it=_xyzs.begin();it!=_xyzs.end();){
489  x = *it;it++;
490  y = *it;it++;
491  z = *it;it++;
492  a_action.project_point(x,y,z,w); //in [-1,1][-1,1]
493  _add(pts, x-hsx,y-hsy,z);
494  _add(pts, x+hsx,y+hsy,z);
495  _add(pts, x+hsx,y-hsy,z);
496  _add(pts, x-hsx,y+hsy,z);
497  }
498  }
499 
500  a_action.load_matrices_to_identity();
501 
502  //Same logic as Inventor SoLightModel.model = BASE_COLOR.
503  a_action.set_lighting(false);
504  a_action.draw_vertex_array(filled?gl::triangles():gl::lines(),pts);
505  a_action.set_lighting(a_action.state().m_GL_LIGHTING);
506  a_action.load_matrices_from_state();
507  }

Member Data Documentation

◆ size

sf<float> tools::sg::markers::size

Definition at line 26 of file markers.

◆ style

sf_enum<marker_style> tools::sg::markers::style

Definition at line 24 of file markers.

◆ xyzs

mf<float> tools::sg::markers::xyzs

Definition at line 25 of file markers.


The documentation for this class was generated from the following file:
tools::sg::marker_swiss_cross_filled
@ marker_swiss_cross_filled
Definition: enums:32
tools::sg::marker_plus
@ marker_plus
Definition: enums:19
tools::sg::markers
Definition: markers:21
tools::sg::marker_david_star_filled
@ marker_david_star_filled
Definition: enums:30
tools::sg::marker_circle_line
@ marker_circle_line
Definition: enums:23
tools::sg::marker_minus
@ marker_minus
Definition: enums:39
tools::gl::triangles
mode_t triangles()
Definition: glprims:20
tools::sg::bmf::add
void add(const T &a_value)
Definition: bmf:73
tools::sg::marker_triangle_up_filled
@ marker_triangle_up_filled
Definition: enums:26
tools::sg::markers::_add
void _add(std::vector< float > &a_v, float a_x, float a_y, float a_z)
Definition: markers:618
tools::sg::marker_penta_star_filled
@ marker_penta_star_filled
Definition: enums:38
tools::sg::marker_triangle_down_line
@ marker_triangle_down_line
Definition: enums:27
tools::sg::marker_cross
@ marker_cross
Definition: enums:21
tools::gl::lines
mode_t lines()
Definition: glprims:17
tools::sg::marker_swiss_cross_line
@ marker_swiss_cross_line
Definition: enums:31
tools::sg::marker_star
@ marker_star
Definition: enums:22
tools::fcos
float fcos(const float &x)
Definition: mathf:42
tools::sg::marker_triangle_down_filled
@ marker_triangle_down_filled
Definition: enums:28
tools::sg::marker_dot
@ marker_dot
Definition: enums:18
tools::sg::marker_penta_star_line
@ marker_penta_star_line
Definition: enums:37
tools::sg::bmf::values
const std::vector< T > & values() const
Definition: bmf:71
tools::intersect
bool intersect(const VEC2 &P1, const VEC2 &Q1, const VEC2 &P2, const VEC2 &Q2, VEC2 &a_out)
Definition: geom2:93
tools::sg::markers::size
sf< float > size
Definition: markers:26
tools::sg::marker_circle_filled
@ marker_circle_filled
Definition: enums:24
tools::sg::marker_square_line
@ marker_square_line
Definition: enums:35
tools::sg::marker_david_star_line
@ marker_david_star_line
Definition: enums:29
tools::sg::bmf::clear
void clear()
Definition: bmf:108
tools::sg::marker_diamond_filled
@ marker_diamond_filled
Definition: enums:34
tools::fhalf_pi
float fhalf_pi()
Definition: mathf:13
tools::ftwo_pi
float ftwo_pi()
Definition: mathf:12
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::marker_triangle_up_line
@ marker_triangle_up_line
Definition: enums:25
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::fsin
float fsin(const float &x)
Definition: mathf:43
tools::sg::bmf::size
size_t size() const
Definition: bmf:69
tools::sg::marker_diamond_line
@ marker_diamond_line
Definition: enums:33
tools::sg::marker_asterisk
@ marker_asterisk
Definition: enums:20
tools::sg::marker_square_filled
@ marker_square_filled
Definition: enums:36
tools::sg::markers::style
sf_enum< marker_style > style
Definition: markers:24
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71
tools::sg::markers::xyzs
mf< float > xyzs
Definition: markers:25