Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_canvas.cxx
Go to the documentation of this file.
1 /*
2  Copyright 2002-2017 Pierre SMARS (smars@yuntech.edu.tw)
3  This program is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 2 of the License, or
6  (at your option) any later version.
7 
8  This program 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
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #include "vtkAppendPolyData.h"
17 #include "vtkBoxWidget.h"
18 #include "vtkCamera.h"
19 #include "vtkCellArray.h"
20 #include "vtkClipPolyData.h"
21 #include "vtkCommand.h"
22 #include "vtkDataSetMapper.h"
23 #include "vtkInteractorStyleTrackballCamera.h"
24 #include "vtkInteractorStyleTrackballActor.h"
25 #include "vtkInteractorStyleSwitch.h"
26 #include "vtkIterativeClosestPointTransform.h"
27 #include "vtkJPEGWriter.h"
28 #include "vtkPNGWriter.h"
29 #include "vtkLight.h"
30 #include "vtkLightCollection.h"
31 #include "vtkObject.h"
32 #include "vtkPlane.h"
33 #include "vtkPlanes.h"
34 #include "vtkPlaneWidget.h"
35 #include "vtkPoints.h"
36 #include "vtkPolyDataMapper.h"
37 #include "vtkPolyDataWriter.h"
38 #include "vtkProperty.h"
39 #include "vtkRenderLargeImage.h"
40 #include "vtkRenderer.h"
41 #include "vtkRenderWindow.h"
42 #include "vtkRenderWindowInteractor.h"
43 #include "vtkRIBExporter.h"
44 #include "vtkTIFFWriter.h"
45 #include "vtkTransform.h"
46 #include "vtkVRMLExporter.h"
47 #include "vtkWindowToImageFilter.h"
48 // #include "vtkXRenderWindowTclInteractor.h"
49 #include "vtkCellPicker.h"
50 #include "vtkPropPicker.h"
51 #include "a_dxf_group.h"
52 #include "a_dxf_entity.h"
53 #include "a_dxf_point.h"
54 #include "a_dxf_line.h"
55 #include "a_dxf_polyline.h"
56 #include "a_interactor.h"
57 
58 #include <sstream>
59 #include <algorithm>
60 #include "a_canvas.h"
61 
62 #define DE(x) std::cerr << #x << ": " << x << std::endl;
63 
64 const double d2r=3.14159265358979/180.;
65 const double r2d=180./3.14159265358979;
66 const double very_small = 0.00001;
67 //---------------------------------------------------------------------------
68 const std::string a_canvas::help()
69 {
70  std::ostringstream o;
71  o << "**********" << std::endl;
72  o << "a_canvas:" << std::endl;
73  o << "**********" << std::endl;
74  o << "This is a 3D window class" << std::endl;
75  o << "Commands:" << std::endl;
76  o << "--------" << std::endl;
77  o << "a_canvas C: create a window named C" << std::endl;
78  o << "windows can display various types of objects:" << std::endl;
79  o << "a_pointcloud, a_linecloud, a_trianglecloud" << std::endl;
80  o << "(look at the corresponding help files for details)" << std::endl;
81  o << "Object management:" << std::endl;
82  o << "................" << std::endl;
83  o << "an object receives a handle when it is created" << std::endl;
84  o << " ex: if 'a_pointcloud pts' is used to create an object" << std::endl;
85  o << " 'pts' is the object handle" << std::endl;
86  o << " the handle is used to access the functions" << std::endl;
87  o << " 'pts name somename' is used to assign the name 'somename' to the object" << std::endl;
88  o << " name and handle should be different!!!" << std::endl;
89  o << "object add HANDLE: add/link a new object (created before)" << std::endl;
90  o << "object set NAME: set current object" << std::endl;
91  o << "object unlink NAME: unlink object" << std::endl;
92  o << "object list: return the name list of the existing objects" << std::endl;
93  o << "(alternatively: 'object ls')" << std::endl;
94  o << "object name: return the name of the current object" << std::endl;
95  o << "objecth: return the handle of the current object" << std::endl;
96  o << "object exist NAME: check whether object exists (returns 0 or 1)" << std::endl;
97  o << "Navigating:" << std::endl;
98  o << ".........." << std::endl;
99  o << "interact: start mouse control (click 'e' to exit)" << std::endl;
100  o << "redraw: refresh screen" << std::endl;
101  o << "fit: fit data to screen" << std::endl;
102  o << "straighten: put the vertical vertical" << std::endl;
103  o << "background R G B: change background color" << std::endl;
104  o << "perspective on: perspective view" << std::endl;
105  o << "perspective off: parallel view" << std::endl;
106  o << "cursor on: show cursor" << std::endl;
107  o << "cursor off: hide cursor" << std::endl;
108  o << "x: look in the direction of positive x" << std::endl;
109  o << "X: look in the direction of negative X" << std::endl;
110  o << "y: look in the direction of positive y" << std::endl;
111  o << "Y: look in the direction of negative Y" << std::endl;
112  o << "z: look in the direction of positive z" << std::endl;
113  o << "Z: look in the direction of negative Z" << std::endl;
114  o << "azimuth V: set azimuth angle" << std::endl;
115  o << "azimuth: get azimuth angle" << std::endl;
116  o << "(similar functions for elevation, roll, pich, yaw, distance)" << std::endl;
117  o << "up: set Z up" << std::endl;
118  o << "camerapoint X Y Z: set view point" << std::endl;
119  o << "camerapoint: get view point" << std::endl;
120  o << "focalpoint X Y Z: set focal point" << std::endl;
121  o << "focalpoint: get focal point" << std::endl;
122  o << "light sun: fixed light" << std::endl;
123  o << "light spot: light follow camera" << std::endl;
124  o << "Input/Output:" << std::endl;
125  o << "............" << std::endl;
126  o << "save CODE FILE" << std::endl;
127  o << "(code: jpeg, png, vec, vrml, vtk)" << std::endl;
128  o << "magnification V: set factor of magnification for the production of images" << std::endl;
129  o << "scale V: set scale of parallel views" << std::endl;
130  o << "scale: get scale of parallel views" << std::endl;
131  o << "logfile A_TEXT: log is saved to a a_text object" << std::endl;
132  o << "outputfile A_TEXT: output is saved to a a_text object" << std::endl;
133  o << "A_TEXT should be created before: ex: a_text NAME" << std::endl;
134  o << "(not all functions are documented, to be completed...)" << std::endl;
135  return o.str();
136 }
137 //---------------------------------------------------------------------------
138 class testcallback : public vtkCommand
139 {
140  public:
141  static testcallback *New() {return new testcallback;}
142  void iren(vtkRenderWindowInteractor * iren) {iren_=iren;}
143  virtual void Execute(vtkObject *caller, unsigned long, void*)
144  {
145  std::cout << "." << std::endl;;
146  iren_->CreateTimer(VTKI_TIMER_UPDATE);
147  }
148  private:
149  vtkRenderWindowInteractor * iren_;
150 };
151 //---------------------------------------------------------------------------
153 {
154  public:
155  static deformcallback *New() { return new deformcallback; }
156  virtual void Execute(vtkObject *caller, unsigned long, void*)
157  {
158  vtkTransform *t = vtkTransform::New();
159  vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
160  widget->GetTransform(t);
161  widget->GetProp3D()->SetUserTransform(t);
162  t->Delete();
163  }
164 };
165 //---------------------------------------------------------------------------
166 class cutcallback : public vtkCommand
167 {
168  public:
169  static cutcallback *New() { return new cutcallback; }
170  void set_plane(vtkPlane * plane) {plane_=plane;}
171  void set_actor(vtkActor * actor) {actor_=actor;}
172  virtual void Execute(vtkObject *caller, unsigned long, void*)
173  {
174  vtkPlaneWidget * widget = reinterpret_cast<vtkPlaneWidget *>(caller);
175  widget->GetPlane(plane_);
176  actor_->VisibilityOn();
177  }
178  private:
179  vtkPlane * plane_;
180  vtkActor * actor_;
181 };
182 //---------------------------------------------------------------------------
184 {
185  name_ = "a_canvas";
186  ren_ = vtkRenderer::New();
187  renWin_ = vtkRenderWindow::New();
188  renWin_->AddRenderer(ren_);
189  ren_->Delete();
190  renWin_->SetStereoTypeToAnaglyph();
191  renWin_->SetWindowName(name_.c_str());
192  renWin_->LineSmoothingOn();
193  renWin_->SetSize(640,480);
194  active_element_ = 0;
195  a_interactor * style = a_interactor::New();
196  style->name("a_canvas");
197  style->keep_color();
198  iren_ = vtkRenderWindowInteractor::New();
199  iren_->SetRenderWindow(renWin_);
200  iren_->SetInteractorStyle(style);
201  iren_->Initialize();
202  //testcallback * cb = testcallback::New();
203  //cb->iren(iren_);
204  //iren_->AddObserver(vtkCommand::TimerEvent, cb);
205  //iren_->CreateTimer(VTKI_TIMER_FIRST);
206  empty_ = true;
207  one_point_ = false;
208  spotlight_ = true;
209  clip_[0] = 0.1; clip_[1] = 1000;
210  magnification_ = 1.;
211  log_.file("a_canvas.log");
212  log_.on();
213  log_ << "#!/usr/bin/env tclsh" << std::endl;
214  log_ << "package require a_canvas" << std::endl;
215  log_ << "a_canvas window_name" << std::endl;
216 }
217 //---------------------------------------------------------------------------
219 {
220  //empty content
221  this->clear();
222  //empty container
223  this->reset_interact();
224  ren_->Delete();
225  renWin_->Delete(); // gives problems
226  // if (iren_) iren_->Delete(); //only if interact() was issued!
227  log_ << "rename window_name \"\"" << std::endl;
228 }
229 //---------------------------------------------------------------------------
231 {
233  log_ << "window_name clear" << std::endl;
234 }
235 //---------------------------------------------------------------------------
236 void a_canvas::name(const std::string& name)
237 {
238  name_ = name;
239  renWin_->SetWindowName(name_.c_str());
240  a_interactor * style = (a_interactor *)(iren_->GetInteractorStyle());
241  style->name(name_);
242  renWin_->Render();
243 }
244 //---------------------------------------------------------------------------
245 void a_canvas::logfile(a_text& text)
246 {
247  log_ << "setlogfile" << std::endl;
248  log_ = text;
249 }
250 //---------------------------------------------------------------------------
251 void a_canvas::outputfile(a_text& text)
252 {
253  log_ << "setoutputfile" << std::endl;
254  output_ = text;
255 }
256 //---------------------------------------------------------------------------
257 //class used to compute the bounding box of the elements_
259 {
260  public:
261  a_bounding_box();
262  void operator() (a_element *);
263  double m(const char) const;
264  double d() const;
265  double x() const;
266  double y() const;
267  double z() const;
268  private:
269  double l_[6];
270 };
272 {
273  for (int i = 0; i < 3; i++) l_[i*2] = 1e30;
274  for (int i = 0; i < 3; i++) l_[i*2+1] = -1e30;
275 }
277 {
278  if (!l->empty())
279  {
280  double b[6];
281  l->actor()->GetBounds(b);
282  for (int i = 0; i < 3; i++)
283  if (b[i*2]<l_[i*2]) {l_[i*2] = b[i*2];}
284  for (int i = 0; i < 3; i++)
285  if (b[i*2+1]>l_[i*2+1]) {l_[i*2+1] = b[i*2+1];}
286  }
287 }
288 double a_bounding_box::x() const
289 {
290  return l_[1]-l_[0];
291 }
292 double a_bounding_box::y() const
293 {
294  return l_[3]-l_[2];
295 }
296 double a_bounding_box::z() const
297 {
298  return l_[5]-l_[4];
299 }
300 double a_bounding_box::d() const // a reference distance
301 {
302  double d0 = 0;
303  for (int i = 0; i < 3; i++) d0 += (l_[i*2+1]-l_[i*2])*(l_[i*2+1]-l_[i*2]);
304  return sqrt(d0);
305 }
306 double a_bounding_box::m(const char i) const // the centre of the object
307 {
308  return (l_[i*2]+l_[i*2+1])/2;
309 }
310 //---------------------------------------------------------------------------
311 bool a_canvas::existelement(const std::string& s) const
312 {
313  for (auto la:elements_)
314  {
315  std::string name = la->name();
316  if (name==s)
317  return true;
318  }
319  return false;
320 }
321 //---------------------------------------------------------------------------
322 bool a_canvas::existelement(const std::string& s, a_element *& p) const
323 {
324  for (auto la:elements_)
325  {
326  std::string name = la->name();
327  if (name==s)
328  {
329  p = la;
330  return true;
331  }
332 
333  }
334  return false;
335 }
336 //---------------------------------------------------------------------------
338 {
339  a_element * p;
340  if (!this->existelement(la_in.name(),p)) //if the element doesn't exist yet
341  {
342  //find the centre of existing points
343  double fo[3];
344  if (!empty_)
345  {
346  a_bounding_box box;
347  //box = std::for_each(elements_.begin(),elements_.end(),box);
348  for (int i =0; i < elements_.size(); i++)
349  box(elements_[i]);
350  for (int i = 0; i < 3; i++) fo[i] = box.m(i);
351  }
352  la_in.setcanvas(*this);
353  la_in.flushlog();
354  active_element_ = &la_in;
355  elements_.push_back(&la_in);
356  ren_->AddActor(la_in.actor());
357  log_ << "window_name object add $" << la_in.name() << std::endl;
358  if (!la_in.empty())
359  {
360  empty_ = false;
361  renWin_->Render();
362  }
363  }
364 }
365 //---------------------------------------------------------------------------
367 {
368  std::string s;
369  for (auto la:elements_)
370  s += la->name() + " ";
371  if (s.size() != 0)
372  s = s.substr(0,s.size()-1);
373  log_ << "window_name object ls" << std::endl;
374  return s;
375 }
376 //---------------------------------------------------------------------------
377 void a_canvas::setelement(const std::string& s)
378 {
379  a_element * p;
380  if (!(this->existelement(s,p))) //if the element doesn't exist yet
381  throw no_element_error();
382  active_element_ = p;
383  log_ << "window_name object set " << s << std::endl;
384 }
385 //---------------------------------------------------------------------------
386 void a_canvas::unlinkelement(const std::string& s)
387 {
388  if (active_element_->name() == s) //cannot erase current element
389  throw notallowed_error();
390  a_element * p;
391  if (!this->existelement(s,p)) //if the element doesn't exist yet
392  throw no_element_error();
393  std::vector<a_element *>::iterator li = std::find(elements_.begin(),elements_.end(),p);
394  ren_->RemoveActor(p->actor());
395  renWin_->Render();
396  elements_.erase(li);
397  log_ << "window_name object rm " << s << std::endl;
398 }
399 //---------------------------------------------------------------------------
400 const std::string a_canvas::getelementname() const
401 {
402  return active_element_->name();
403 }
404 //---------------------------------------------------------------------------
405 void a_canvas::fitelements(const std::string & r_mesh, const std::string& r_points)
406 {
407  a_element * mesh, * points;
408  if (!this->existelement(r_mesh,mesh)) //if the element doesn't exist yet
409  throw no_element_error();
410  if (!this->existelement(r_points,points)) //if the element doesn't exist yet
411  throw no_element_error();
412  std::vector<a_element *>::iterator li = std::find(elements_.begin(),elements_.end(),mesh);
413  li = std::find(elements_.begin(),elements_.end(),points);
414  if (mesh->type() == "a_trianglecloud")
415  throw notallowed_error();
416  vtkIterativeClosestPointTransform * transform = vtkIterativeClosestPointTransform::New();
417  transform->SetSource(points->polydata());
418  transform->SetTarget(mesh->polydata());
419  transform->SetMaximumNumberOfIterations(100);
420  transform->CheckMeanDistanceOn();
421  transform->SetMeanDistanceModeToRMS();
422  transform->SetMaximumMeanDistance(0.01);
423 }
424 //---------------------------------------------------------------------------
426 {
427  if (empty_) return;
428  spotlight_ = true;
430  ren_->LightFollowCameraOn();
431  if (iren_)
432  iren_->LightFollowCameraOn();
433  renWin_->Render();
434  log_ << "window_name light spot" << std::endl;
435 }
436 //---------------------------------------------------------------------------
438 {
439  if (empty_) return;
440  spotlight_ = false;
442  ren_->LightFollowCameraOff();
443  if (iren_)
444  iren_->LightFollowCameraOff();
445  renWin_->Render();
446  //this->output_position();
447  log_ << "window_name light sun" << std::endl;
448 }
449 //---------------------------------------------------------------------------
451 {
452  if (empty_) return;
453  ren_->GetActiveCamera()->ParallelProjectionOn();
454  renWin_->Render();
455  log_ << "window_name perspective off" << std::endl;
456 }
457 //---------------------------------------------------------------------------
459 {
460  if (empty_) return;
461  ren_->GetActiveCamera()->ParallelProjectionOff();
462  renWin_->Render();
463  log_ << "window_name perspective on" << std::endl;
464 }
465 //---------------------------------------------------------------------------
466 void a_canvas::magnification(unsigned short val)
467 {
468  a_interactor * style = (a_interactor *)(iren_->GetInteractorStyle());
469  style->magnification(val);
470  magnification_ = val;
471  log_ << "window_name magnification " << val << std::endl;
472 }
473 //---------------------------------------------------------------------------
474 double a_canvas::scale() const
475 {
476  double h = ren_->GetSize()[1];
477  double s = ren_->GetActiveCamera()->GetParallelScale();
478  if (s!=0.)
479  s = (magnification_*(h/2.))/s;
480  return s;
481 }
482 //---------------------------------------------------------------------------
483 void a_canvas::scale(double val)
484 {
485  renWin_->Render();
486  double h = ren_->GetSize()[1];
487  double s = (h/2.)*(magnification_/val);
488  ren_->GetActiveCamera()->SetParallelScale(s);
489  renWin_->Render();
490  log_ << "window_name scale " << val << std::endl;
491 }
492 //---------------------------------------------------------------------------
494 {
495  vtkCamera * cam = ren_->GetActiveCamera();
496  a_point c(cam->GetPosition());
497  a_point f(cam->GetFocalPoint());
498  a_point dir = f-c;
499  this->unroll();
501  this->render_clip();
502 }
503 //---------------------------------------------------------------------------
505 {
506  int n_actors = elements_.size();
507  int n_total = ren_->GetActors()->GetNumberOfItems();
508  for (int i=0;i<n_total-n_actors;i++)
509  {
510  vtkActor * actor = ren_->GetActors()->GetLastActor();
511  ren_->RemoveActor(actor);
512  std::cout << ".";
513  }
514  std::cout << std::endl;
515 }
516 //---------------------------------------------------------------------------
518 {
519  if (empty_) return;
520  vtkBoxWidget * boxWidget = vtkBoxWidget::New();
521  boxWidget->SetInteractor(iren_);
522  boxWidget->SetPlaceFactor(1.25);
523  boxWidget->SetProp3D(active_element_->actor());
524  boxWidget->PlaceWidget();
525  boxWidget->ScalingEnabledOff();
526  boxWidget->OutlineFaceWiresOff();
527  boxWidget->HandlesOff();
528  deformcallback *callback = deformcallback::New();
529  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
530  boxWidget->On();
531  iren_->Start();
532  boxWidget->RemoveObserver(callback);
533  boxWidget->Delete();
534  this->reset_interact();
535 }
536 //---------------------------------------------------------------------------
538 {
539  if (empty_) return;
540  vtkBoxWidget * boxWidget = vtkBoxWidget::New();
541  boxWidget->SetInteractor(iren_);
542  boxWidget->SetPlaceFactor(1.25);
543  boxWidget->SetProp3D(active_element_->actor());
544  boxWidget->PlaceWidget();
545  deformcallback *callback = deformcallback::New();
546  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
547  boxWidget->On();
548  iren_->Start();
549  boxWidget->RemoveObserver(callback);
550  boxWidget->Delete();
551  this->reset_interact();
552 }
553 //---------------------------------------------------------------------------
555 {
556  if (empty_) return;
557  vtkPlaneWidget * Widget = vtkPlaneWidget::New();
558  Widget->SetInteractor(iren_);
559  Widget->SetRepresentationToSurface();
560  Widget->SetPlaceFactor(1.25);
561  Widget->SetProp3D(active_element_->actor());
562  Widget->PlaceWidget();
563  Widget->GetPlaneProperty()->SetOpacity(.3);
564  Widget->GetSelectedPlaneProperty()->SetColor(0.9,0.9,0.9);
565  vtkPlane * plane = vtkPlane::New();
566  Widget->GetPlane(plane);
567  active_element_->actor()->GetMapper()->AddClippingPlane(plane);
568  cutcallback * callback = cutcallback::New();
569  callback->set_plane(plane);
570  callback->set_actor(active_element_->actor());
571  Widget->AddObserver(vtkCommand::InteractionEvent, callback);
572  Widget->On();
573  iren_->Start();
574  active_element_->actor()->GetMapper()->RemoveAllClippingPlanes();
575  plane->Delete();
576  Widget->RemoveObserver(callback);
577  // callback->Delete();
578  Widget->Delete();
579  this->reset_interact();
580 }
581 //---------------------------------------------------------------------------
582 /*
583  void a_canvas::cut_interact2()
584  {
585  if (empty_) return;
586  vtkPolyData * data = vtkPolyData::New();
587  data->DeepCopy(active_element_->polydata());
588  vtkPlaneWidget * Widget = vtkPlaneWidget::New();
589  Widget->SetInteractor(iren_);
590  Widget->SetRepresentationToSurface();
591  Widget->SetPlaceFactor(1.25);
592  Widget->SetProp3D(active_element_->actor());
593  Widget->PlaceWidget();
594  vtkPlane * plane = vtkPlane::New();
595  Widget->GetPlane(plane);
596  vtkClipPolyData * clip = vtkClipPolyData::New();
597  clip->SetInput(data);
598  plane->Delete();
599  vtkPolyDataMapper * map = vtkPolyDataMapper::New();
600  map->SetInput(clip->GetOutput());
601  vtkActor * cut = vtkActor::New();
602  cut->SetMapper(map);
603  cut->GetProperty()->SetColor(.5,.5,.7);
604  ren_->AddActor(cut);
605  cutcallback * callback = cutcallback::New();
606  callback->set_plane(plane);
607  callback->set_actor(cut);
608  callback->set_map(map);
609  Widget->AddObserver(vtkCommand::InteractionEvent, callback);
610  Widget->On();
611  iren_->Start();
612  ren_->RemoveActor(cut);
613  this->reset_interact();
614  }
615  */
616 //---------------------------------------------------------------------------
618 {
619  if (empty_) return;
620  iren_->Start();
621  this->reset_interact();
622  /*
623  // iren_->Initialize();
624  // iren_->Enable();
625  if (iren_==0)
626  {
627  std::cerr << "interactor started" << std::endl;
628  // view_pt_interactor * style = view_pt_interactor::New();
629  vtkInteractorStyleTrackballCamera * style = vtkInteractorStyleTrackballCamera::New();
630  iren_ = vtkRenderWindowInteractor::New();
631  iren_->SetRenderWindow(renWin_);
632  // renWin_->Delete();
633  iren_->SetInteractorStyle(style);
634  // iren_->Initialize();
635  std::cerr << iren_->GetRenderWindow() << std::endl;
636  std::cerr << renWin_ << std::endl;
637  iren_->Start();
638  // iren_ = vtkRenderWindowInteractor::New();
639  //iren_ = vtkXRenderWindowTclInteractor::New();
640  // iren_->SetRenderWindow(renWin_);
641  // renWin_->MakeCurrent();
642  // style->Delete();
643  // iren_->Initialize();
644  // std::cerr << "interactor on... " << iren_->GetInitialized() << std::endl;
645  // iren_->Start();
646  // iren_->Enable();
647  // iren_->ReInitialize();
648  // iren_->Render();
649  // std::cerr << "+++" << std::endl;
650  // if (!spotlight_) iren_->LightFollowCameraOff();
651  // std::cerr << *iren_ << std::endl;
652  }
653  */
654 }
655 //---------------------------------------------------------------------------
656 double a_canvas::azimuth() const
657 {
658  double el = this->elevation();
659  if ((fabs(el-90.)<very_small)||(fabs(el+90.)<very_small))
660  return 90.-ren_->GetActiveCamera()->GetRoll();
661  else
662  {
663  vtkCamera * cam = ren_->GetActiveCamera();
664  a_point c(cam->GetPosition());
665  a_point f(cam->GetFocalPoint());
666  a_point dir = f-c;
667  return atan2(dir.y(),dir.x())*r2d;
668  }
669 }
670 //---------------------------------------------------------------------------
671 void a_canvas::azimuth(double x)
672 {
673  this->unroll();
674  vtkCamera * cam = ren_->GetActiveCamera();
675  double el = this->elevation();
676  if ((fabs(el-90.)<very_small)||(fabs(el+90.)<very_small))
677  {
678  x /= 2.;
679  cam->SetViewUp(cos(x*d2r),sin(x*d2r),0.);
680  this->roll(x);
681  }
682  else
683  {
684  a_point c(cam->GetPosition());
685  a_point f(cam->GetFocalPoint());
686  a_point dir = f-c;
687  double d = dir.norm();
688  double dz = dir.z();
689  double dh = sqrt(d*d-dz*dz);
690  a_point dir2(dh*cos(x*d2r),dh*sin(x*d2r),dz);
691  a_point c2 = f-dir2;
692  cam->SetPosition(c2.x(),c2.y(),c2.z());
694  this->render_clip();
695  }
696 }
697 //---------------------------------------------------------------------------
698 double a_canvas::elevation() const
699 {
700  vtkCamera * cam = ren_->GetActiveCamera();
701  a_point c(cam->GetPosition());
702  a_point f(cam->GetFocalPoint());
703  a_point dir = f-c;
704  a_point vert(0.,0.,-1.);
705  return angle(vert,dir)*r2d-90.;
706 }
707 //---------------------------------------------------------------------------
708 void a_canvas::elevation(double y)
709 {
710  double az = this->azimuth();
711  this->unroll();
712  vtkCamera * cam = ren_->GetActiveCamera();
713  a_point c(cam->GetPosition());
714  a_point f(cam->GetFocalPoint());
715  a_point dir = f-c;
716  a_point dirh(cos(az*d2r),sin(az*d2r),0.);
717  dirh.normalise();
718  double d = dir.norm();
719  double dz = d*sin(y*d2r);
720  double dh = d*cos(y*d2r);
721  a_point dir2(dirh.x()*dh,dirh.y()*dh,dz);
722  a_point c2 = f-dir2;
723  cam->SetPosition(c2.x(),c2.y(),c2.z());
725  this->render_clip();
726 }
727 //---------------------------------------------------------------------------
728 double a_canvas::roll() const
729 {
730  double el = this->elevation();
731  if ((fabs(el-90.)<very_small)||(fabs(el+90.)<very_small))
732  return 0.;
733  else
734  return ren_->GetActiveCamera()->GetRoll();
735 }
736 //---------------------------------------------------------------------------
737 void a_canvas::roll(double z)
738 {
739  /*double el = this->elevation();
740  if ((fabs(el-90.)<very_small)||(fabs(el+90.)<very_small))
741  return;
742  */
743  ren_->GetActiveCamera()->Roll(-z);
744  this->render_clip();
745 }
746 //---------------------------------------------------------------------------
747 void a_canvas::yaw(double x)
748 {
749  this->unroll();
750  vtkCamera * cam = ren_->GetActiveCamera();
751  a_point c(cam->GetPosition());
752  a_point f(cam->GetFocalPoint());
753  a_point dir = f-c;
754  double d = dir.norm();
755  double dz = dir.z();
756  double dh = sqrt(d*d-dz*dz);
757  a_point dir2(dh*cos(x*d2r),dh*sin(x*d2r),dz);
758  a_point f2 = c+dir2;
759  cam->SetFocalPoint(f2.x(),f2.y(),f2.z());
761  this->render_clip();
762 }
763 //---------------------------------------------------------------------------
764 void a_canvas::pitch(double y)
765 {
766  this->unroll();
767  vtkCamera * cam = ren_->GetActiveCamera();
768  a_point c(cam->GetPosition());
769  a_point f(cam->GetFocalPoint());
770  a_point dir = f-c;
771  double d = dir.norm();
772  double az = this->azimuth();
773  a_point dirh(cos(az*d2r),sin(az*d2r),0.);
774  dirh.normalise();
775  double dz = d*sin(y*d2r);
776  double dh = d*cos(y*d2r);
777  a_point dir2(dirh.x()*dh,dirh.y()*dh,dz);
778  a_point f2 = c+dir2;
779  cam->SetFocalPoint(f2.x(),f2.y(),f2.z());
781  this->render_clip();
782 }
783 //---------------------------------------------------------------------------
785 {
786  double el = this->elevation();
787  if ((fabs(el-90.)<very_small)||(fabs(el+90.)<very_small))
788  return;
789  ren_->GetActiveCamera()->Roll(0.);
790  this->up(a_point(0.,0.,1.));
791 }
792 //---------------------------------------------------------------------------
793 void a_canvas::distance(double d)
794 {
795  a_point fop = this->focalpoint();
796  a_point pop = this->viewpoint();
797  a_point pop2 = d*(pop-fop).normalise();
798  this->viewpoint(fop+pop2);
799  this->render_clip();
800 }
801 //---------------------------------------------------------------------------
802 double a_canvas::distance() const
803 {
804  a_point fop = this->focalpoint();
805  a_point pop = this->viewpoint();
806  return (fop-pop).norm();
807 }
808 //---------------------------------------------------------------------------
809 void a_canvas::distance0(double v)
810 {
811  a_bounding_box box;
812  for (int i =0; i < elements_.size(); i++)
813  box(elements_[i]);
814  // box = std::for_each(elements_.begin(),elements_.end(),box);
815  double d0 = box.d();
816  double d = 2*d0*exp(log(10.)*v/100.);
817  this->distance(d);
818 }
819 //---------------------------------------------------------------------------
820 void a_canvas::background(double R, double G, double B)
821 {
822  if (R>=0. && R<=1. && G>=0. && G<=1. && B>=0. && B<=1.)
823  {
824  ren_->SetBackground(R,G,B);
825  renWin_->Render();
826  }
827 }
828 //---------------------------------------------------------------------------
830 {
831  vtkCamera * cam = ren_->GetActiveCamera();
832  double po[3], fo[3];
833  cam->GetPosition(po);
834  cam->GetFocalPoint(fo);
835  a_point p_po(po);
836  a_point p_fo(fo);
837  a_point dir(1.,0.,0.);
838  double dist = (p_fo-p_po).norm();
839  a_point np_po = p_fo-dir*dist;
840  cam->SetPosition(np_po.x(),np_po.y(),np_po.z());
841  cam->SetViewUp(0.,0.,1.);
842  renWin_->Render();
843 }
844 //---------------------------------------------------------------------------
846 {
847  vtkCamera * cam = ren_->GetActiveCamera();
848  double po[3], fo[3];
849  cam->GetPosition(po);
850  cam->GetFocalPoint(fo);
851  a_point p_po(po);
852  a_point p_fo(fo);
853  a_point dir(-1.,0.,0.);
854  double dist = (p_fo-p_po).norm();
855  a_point np_po = p_fo-dir*dist;
856  cam->SetPosition(np_po.x(),np_po.y(),np_po.z());
857  cam->SetViewUp(0.,0.,1.);
858  renWin_->Render();
859 }
860 //---------------------------------------------------------------------------
862 {
863  vtkCamera * cam = ren_->GetActiveCamera();
864  double po[3], fo[3];
865  cam->GetPosition(po);
866  cam->GetFocalPoint(fo);
867  a_point p_po(po);
868  a_point p_fo(fo);
869  a_point dir(0.,1.,0.);
870  double dist = (p_fo-p_po).norm();
871  a_point np_po = p_fo-dir*dist;
872  cam->SetPosition(np_po.x(),np_po.y(),np_po.z());
873  cam->SetViewUp(0.,0.,1.);
874  renWin_->Render();
875 }
876 //---------------------------------------------------------------------------
878 {
879  vtkCamera * cam = ren_->GetActiveCamera();
880  double po[3], fo[3];
881  cam->GetPosition(po);
882  cam->GetFocalPoint(fo);
883  a_point p_po(po);
884  a_point p_fo(fo);
885  a_point dir(0.,-1.,0.);
886  double dist = (p_fo-p_po).norm();
887  a_point np_po = p_fo-dir*dist;
888  cam->SetPosition(np_po.x(),np_po.y(),np_po.z());
889  cam->SetViewUp(0.,0.,1.);
890  renWin_->Render();
891 }
892 //---------------------------------------------------------------------------
894 {
895  vtkCamera * cam = ren_->GetActiveCamera();
896  double po[3], fo[3];
897  cam->GetPosition(po);
898  cam->GetFocalPoint(fo);
899  a_point p_po(po);
900  a_point p_fo(fo);
901  a_point dir(0.,0.,1.);
902  double dist = (p_fo-p_po).norm();
903  a_point np_po = p_fo-dir*dist;
904  cam->SetPosition(np_po.x(),np_po.y(),np_po.z());
905  cam->SetViewUp(1.,0.,0.);
906  renWin_->Render();
907 }
908 //---------------------------------------------------------------------------
910 {
911  vtkCamera * cam = ren_->GetActiveCamera();
912  double po[3], fo[3];
913  cam->GetPosition(po);
914  cam->GetFocalPoint(fo);
915  a_point p_po(po);
916  a_point p_fo(fo);
917  a_point dir(0.,0.,-1.);
918  double dist = (p_fo-p_po).norm();
919  a_point np_po = p_fo-dir*dist;
920  cam->SetPosition(np_po.x(),np_po.y(),np_po.z());
921  cam->SetViewUp(1.,0.,0.);
922  renWin_->Render();
923 }
924 //---------------------------------------------------------------------------
925 int a_canvas::width() const
926 {
927  return ren_->GetSize()[0];
928 }
929 //
930 //---------------------------------------------------------------------------
931 int a_canvas::height() const
932 {
933  return ren_->GetSize()[1];
934 }
935 //---------------------------------------------------------------------------
937 {
938  vtkCamera * cam = ren_->GetActiveCamera();
939  double pt[3];
940  cam->GetFocalPoint(pt);
941  log_ << "window_name focalpoint " << pt[0] << " " << pt[1] << " " << pt[2] << std::endl;
942  cam->GetPosition(pt);
943  log_ << "window_name viewpoint " << pt[0] << " " << pt[1] << " " << pt[2] << std::endl;
944 }
945 //---------------------------------------------------------------------------
946 void a_canvas::pan(const double * pt)
947 {
948  a_point move(pt);
949  if (move.norm() > very_small)
950  {
951  a_point vn = this->viewpoint()+move;
952  a_point fn = this->focalpoint()+move;
953  double vna[] = {vn.x(), vn.y(), vn.z()};
954  double fna[] = {fn.x(), fn.y(), fn.z()};
955  this->viewpoint(vna);
956  this->focalpoint(fna);
957  }
958 }
959 //---------------------------------------------------------------------------
960 a_point a_canvas::viewpoint() const
961 {
962  vtkCamera * cam = ren_->GetActiveCamera();
963  double po[3];
964  cam->GetPosition(po);
965  return a_point(po);
966 }
967 //---------------------------------------------------------------------------
968 a_point a_canvas::focalpoint() const
969 {
970  vtkCamera * cam = ren_->GetActiveCamera();
971  double fp[3];
972  cam->GetFocalPoint(fp);
973  return a_point(fp);
974 }
975 //---------------------------------------------------------------------------
976 a_point a_canvas::up() const
977 {
978  vtkCamera * cam = ren_->GetActiveCamera();
979  double up[3];
980  cam->GetViewUp(up);
981  return a_point(up);
982 }
983 //---------------------------------------------------------------------------
984 void a_canvas::viewpoint(const a_point& c)
985 {
986  vtkCamera * cam = ren_->GetActiveCamera();
987  a_point f(cam->GetFocalPoint());
988  a_point dir = f-c;
989  //view and focal points cannot coincide
990  if (dir.norm() > very_small)
991  {
992  cam->SetPosition(c.x(),c.y(),c.z());
994  this->render_clip();
995  }
996 }
997 //---------------------------------------------------------------------------
998 void a_canvas::focalpoint(const a_point& f)
999 {
1000 
1001  vtkCamera * cam = ren_->GetActiveCamera();
1002  a_point c(cam->GetPosition());
1003  a_point dir = f-c;
1004  //view and focal points cannot coincide
1005  if (dir.norm() > very_small)
1006  {
1007  // this->unroll();
1008  cam->SetFocalPoint(f.x(),f.y(),f.z());
1010  this->render_clip();
1011  }
1012 }
1013 //---------------------------------------------------------------------------
1014 void a_canvas::up(const a_point& p)
1015 {
1016  a_point p2 = p;
1017  if (p.norm() > very_small)
1018  {
1019  p2.normalise();
1020  vtkCamera * cam = ren_->GetActiveCamera();
1021  cam->SetViewUp(p2.x(),p2.y(),p2.z());
1023  this->render_clip();
1024  }
1025 }
1026 //---------------------------------------------------------------------------
1027 void a_canvas::viewpoint(const double * pt)
1028 {
1029  this->viewpoint(a_point(pt[0],pt[1],pt[2]));
1030 }
1031 //---------------------------------------------------------------------------
1032 void a_canvas::focalpoint(const double * pt)
1033 {
1034  this->focalpoint(a_point(pt[0],pt[1],pt[2]));
1035 }
1036 //---------------------------------------------------------------------------
1037 void a_canvas::up(const double * pt)
1038 {
1039  this->up(a_point(pt[0],pt[1],pt[2]));
1040 }
1041 //---------------------------------------------------------------------------
1042 void a_canvas::jpgout(const std::string& file)
1043 {
1044  std::string f0 = file.substr(0,file.find_first_of('.'))+".jpg";
1045  vtkRenderLargeImage * grab = vtkRenderLargeImage::New();
1046  grab->SetInput(ren_);
1047  grab->SetMagnification(magnification_);
1048  vtkJPEGWriter * writer = vtkJPEGWriter::New();
1049  writer->SetFileName(const_cast<char *>(f0.c_str()));
1050  writer->SetInputConnection(grab->GetOutputPort());
1051  writer->SetQuality(100);//between 0 and 100
1052  grab->Delete();
1053  writer->Write();
1054  writer->Delete();
1055  this->output_position();
1056  log_ << "window_name save jpg " << file << std::endl;
1057 }
1058 //---------------------------------------------------------------------------
1059 void a_canvas::pngout(const std::string& file)
1060 {
1061  std::string f0 = file.substr(0,file.find_first_of('.'))+".png";
1062  vtkRenderLargeImage * grab = vtkRenderLargeImage::New();
1063  grab->SetInput(ren_);
1064  grab->SetMagnification(magnification_);
1065  vtkPNGWriter * writer = vtkPNGWriter::New();
1066  writer->SetFileName(const_cast<char *>(f0.c_str()));
1067  writer->SetInputConnection(grab->GetOutputPort());
1068  grab->Delete();
1069  writer->Write();
1070  writer->Delete();
1071  this->output_position();
1072  log_ << "window_name save png " << file << std::endl;
1073 }
1074 //---------------------------------------------------------------------------
1075 void a_canvas::vrmlout(const std::string& file)
1076 {
1077  vtkVRMLExporter * writer = vtkVRMLExporter::New();
1078  writer->SetFileName(file.c_str());
1079  writer->SetInput(renWin_);
1080  writer->Write();
1081  writer->Delete();
1082  log_ << "window_name save vrml " << file << std::endl;
1083 }
1084 //---------------------------------------------------------------------------
1085 void a_canvas::vtkout(const std::string& file)
1086 {
1087  vtkAppendPolyData * datas = vtkAppendPolyData::New();
1088  for (auto la:elements_)
1089  datas->AddInputData(la->polydata());
1090  vtkPolyDataWriter * writer = vtkPolyDataWriter::New();
1091  writer->SetFileName(file.c_str());
1092  writer->SetInputConnection(datas->GetOutputPort());
1093  datas->Delete();
1094  writer->Write();
1095  writer->Delete();
1096  log_ << "window_name save vtk " << file << std::endl;
1097 }
1098 //---------------------------------------------------------------------------
1099 void a_canvas::ribout(const std::string& file)
1100 {
1101  std::string f0 = file.substr(0,file.find_first_of('.'));
1102  vtkRIBExporter * writer = vtkRIBExporter::New();
1103  writer->SetFilePrefix(f0.c_str());
1104  writer->SetInput(renWin_);
1105  writer->Write();
1106  writer->Delete();
1107  this->output_position();
1108  log_ << "window_name save rib " << file << std::endl;
1109 }
1110 //---------------------------------------------------------------------------
1111 void a_canvas::tifout(const std::string& file)
1112 {
1113  std::string f0 = file.substr(0,file.find_first_of('.'))+".tif";
1114  vtkWindowToImageFilter * grab = vtkWindowToImageFilter::New();
1115  grab->SetInput(renWin_);
1116  vtkTIFFWriter * writer = vtkTIFFWriter::New();
1117  writer->SetFileName(const_cast<char *>(f0.c_str()));
1118  writer->SetInputConnection(grab->GetOutputPort());
1119  grab->Delete();
1120  writer->Write();
1121  writer->Delete();
1122  this->output_position();
1123  log_ << "window_name save tiff " << file << std::endl;
1124 }
1125 //---------------------------------------------------------------------------
1127 {
1128  ren_->GetActiveCamera()->SetClippingRange(clip_[0],clip_[1]);
1129  renWin_->Render();
1130 }
1131 //---------------------------------------------------------------------------
1133 {
1134  a_bounding_box box;
1135  for (int i =0; i < elements_.size(); i++)
1136  box(elements_[i]);
1137  // box = std::for_each(elements_.begin(),elements_.end(),box);
1138  double fo[3];
1139  for (int i = 0; i < 3; i++) fo[i] = box.m(i);
1140  double d0 = box.d();
1141  vtkCamera * cam = ren_->GetActiveCamera();
1142  //active for parallel projection
1143  cam->SetParallelScale(box.z());
1144  //active for perspective
1145  cam->SetFocalPoint(fo);
1146  cam->SetPosition(fo[0],fo[1]-2*d0,fo[2]);
1147  cam->ComputeViewPlaneNormal();
1148  cam->SetViewAngle(30);
1149  cam->SetViewUp(0,0,1);
1150  this->render_clip();
1151  this->spotlight();
1152 }
1153 //---------------------------------------------------------------------------
1155 {
1156  double po[3], fo[3];
1157  vtkCamera * cam = ren_->GetActiveCamera();
1158  cam->GetPosition(po);
1159  cam->GetFocalPoint(fo);
1160  vtkLightCollection * lights = ren_->GetLights();
1161  lights->InitTraversal();
1162  vtkLight * light = lights->GetNextItem();
1163  light->SetPosition(po);
1164  light->SetFocalPoint(fo);
1165  light->SetIntensity(1);
1166 }
1167 //*input/output*************************************************
1168 //-operator>>----------------------------------------------------------------
1169 std::istream& operator>> (std::istream& i, a_canvas& w)
1170 {
1171  return i;
1172 }
1173 //-operator<<----------------------------------------------------------------
1174 std::ostream& operator<< (std::ostream& o, a_canvas& w)
1175 {
1176  o << w.elements_.size() << std::endl;
1177  for (auto la:w.elements_)
1178  o << *la;
1179  return o;
1180 }
1181 //---------------------------------------------------------------------------
1182 void a_canvas::open(const std::string& file)
1183 {
1184  std::ifstream ff(file.c_str());
1185  if (ff)
1186  {
1187  ff >> *this;
1188  renWin_->Render();
1189  log_ << "window_name open " << file << std::endl;
1190  }
1191 }
1192 //---------------------------------------------------------------------------
1193 void a_canvas::save(const std::string& file)
1194 {
1195  std::ofstream ff(file.c_str());
1196  if (ff)
1197  {
1198  ff << *this;
1199  log_ << "window_name save " << file << std::endl;
1200  }
1201 }
void delete_vector(std::vector< a_axes * > &)
std::ostream & operator<<(std::ostream &o, a_canvas &w)
Definition: a_canvas.cxx:1174
const double d2r
Definition: a_canvas.cxx:64
std::istream & operator>>(std::istream &i, a_canvas &w)
Definition: a_canvas.cxx:1169
const double very_small
Definition: a_canvas.cxx:66
const double r2d
Definition: a_canvas.cxx:65
double m(const char) const
Definition: a_canvas.cxx:306
double z() const
Definition: a_canvas.cxx:296
void operator()(a_element *)
Definition: a_canvas.cxx:276
double y() const
Definition: a_canvas.cxx:292
double d() const
Definition: a_canvas.cxx:300
double x() const
Definition: a_canvas.cxx:288
a vtk screen
Definition: a_canvas.h:40
bool spotlight_
Definition: a_canvas.h:162
void x()
Definition: a_canvas.cxx:829
double elevation() const
Definition: a_canvas.cxx:698
double roll() const
Definition: a_canvas.cxx:728
void jpgout(const std::string &file)
Definition: a_canvas.cxx:1042
void clear()
Definition: a_canvas.cxx:230
void distance0(double d)
Definition: a_canvas.cxx:809
void Z()
Definition: a_canvas.cxx:909
vtkRenderWindowInteractor * iren_
Definition: a_canvas.h:159
void yaw(double v)
Definition: a_canvas.cxx:747
a_text output_
Definition: a_canvas.h:164
void vtkout(const std::string &file)
Definition: a_canvas.cxx:1085
std::string listelements()
Definition: a_canvas.cxx:366
bool empty_
Definition: a_canvas.h:168
std::vector< a_element * > elements_
Definition: a_canvas.h:155
void save(const std::string &file)
Definition: a_canvas.cxx:1193
double azimuth() const
Definition: a_canvas.cxx:656
void spotlight()
Definition: a_canvas.cxx:425
a_element * active_element_
Definition: a_canvas.h:156
void pitch(double u)
Definition: a_canvas.cxx:764
std::string name_
Definition: a_canvas.h:154
double scale() const
Definition: a_canvas.cxx:474
void magnification(unsigned short val)
Definition: a_canvas.cxx:466
void output_position()
Definition: a_canvas.cxx:936
void unroll()
Definition: a_canvas.cxx:784
void y()
Definition: a_canvas.cxx:861
void X()
Definition: a_canvas.cxx:845
void outputfile(a_text &text)
Definition: a_canvas.cxx:251
virtual void fit_deform_interact()
Definition: a_canvas.cxx:537
void reset()
Definition: a_canvas.cxx:1132
vtkRenderWindow * renWin_
Definition: a_canvas.h:158
void open(const std::string &file)
Definition: a_canvas.cxx:1182
void sunlight()
Definition: a_canvas.cxx:437
int width() const
Definition: a_canvas.cxx:925
float clip_[2]
Definition: a_canvas.h:161
void ribout(const std::string &file)
Definition: a_canvas.cxx:1099
void tifout(const std::string &file)
Definition: a_canvas.cxx:1111
static const std::string help()
Definition: a_canvas.cxx:68
bool existelement(const std::string &s) const
Definition: a_canvas.cxx:311
void Y()
Definition: a_canvas.cxx:877
void pan(const double *pt)
Definition: a_canvas.cxx:946
bool one_point_
Definition: a_canvas.h:169
a_point viewpoint() const
Definition: a_canvas.cxx:960
int height() const
Definition: a_canvas.cxx:931
void background(double R, double G, double B)
Definition: a_canvas.cxx:820
virtual void fit_interact()
Definition: a_canvas.cxx:517
a_text log_
Definition: a_canvas.h:166
const std::string getelementname() const
Definition: a_canvas.cxx:400
void addelement(a_element &l)
Definition: a_canvas.cxx:337
void parallel_view()
Definition: a_canvas.cxx:450
void perspectia_view()
Definition: a_canvas.cxx:458
a_point up() const
Definition: a_canvas.cxx:976
void unlinkelement(const std::string &s)
Definition: a_canvas.cxx:386
double distance() const
Definition: a_canvas.cxx:802
std::string name() const
Definition: a_canvas.h:48
a_point focalpoint() const
Definition: a_canvas.cxx:968
virtual void interact()
Definition: a_canvas.cxx:617
void render_clip()
Definition: a_canvas.cxx:1126
double magnification_
magnification value for exports
Definition: a_canvas.h:171
void z()
Definition: a_canvas.cxx:893
virtual void reset_interact()
Definition: a_canvas.cxx:504
void pngout(const std::string &file)
Definition: a_canvas.cxx:1059
void setlightoncameraposition()
Definition: a_canvas.cxx:1154
void vrmlout(const std::string &file)
Definition: a_canvas.cxx:1075
vtkRenderer * ren_
Definition: a_canvas.h:157
void setelement(const std::string &s)
Definition: a_canvas.cxx:377
a_text & logfile()
Definition: a_canvas.h:52
virtual void straighten()
Definition: a_canvas.cxx:493
void fitelements(const std::string &m, const std::string &p)
Definition: a_canvas.cxx:405
virtual void cut_interact()
Definition: a_canvas.cxx:554
layer used by screen to draw vector graphics
Definition: a_element.h:39
vtkActor * actor()
Definition: a_element.h:70
void setcanvas(a_canvas &can)
Definition: a_element.h:46
void name(std::string &aname)
Definition: a_element.h:49
void flushlog()
Definition: a_element.cxx:132
bool empty() const
Definition: a_element.h:51
virtual std::string type() const
Definition: a_element.h:44
vtkPolyData * polydata()
Definition: a_element.h:71
a generic interactor
Definition: a_interactor.h:29
void name(const std::string &name)
Definition: a_interactor.h:39
static a_interactor * New()
void magnification(int val)
Definition: a_interactor.h:37
void keep_color(const bool val=true)
Definition: a_interactor.h:41
static cutcallback * New()
Definition: a_canvas.cxx:169
void set_plane(vtkPlane *plane)
Definition: a_canvas.cxx:170
void set_actor(vtkActor *actor)
Definition: a_canvas.cxx:171
virtual void Execute(vtkObject *caller, unsigned long, void *)
Definition: a_canvas.cxx:172
static deformcallback * New()
Definition: a_canvas.cxx:155
virtual void Execute(vtkObject *caller, unsigned long, void *)
Definition: a_canvas.cxx:156
void iren(vtkRenderWindowInteractor *iren)
Definition: a_canvas.cxx:142
virtual void Execute(vtkObject *caller, unsigned long, void *)
Definition: a_canvas.cxx:143
static testcallback * New()
Definition: a_canvas.cxx:141
double v(const uint32_t step, const uint32_t n)
Definition: generate.cxx:42
std::string name
Definition: pixelpos.cxx:77
a_point dir(int i, int l)
Definition: rib0.cxx:60
Definition: stlb2stla.cxx:21