Developer Documentation
MovePluginScript.cc
1/*===========================================================================*\
2* *
3* OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39* *
40\*===========================================================================*/
41
42
43
44#include "MovePlugin.hh"
45
46#ifdef ENABLE_POLYLINE_SUPPORT
48#endif
49#ifdef ENABLE_TSPLINEMESH_SUPPORT
50#include <ObjectTypes/TSplineMesh/TSplineMesh.hh>
51#endif
53
54#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
56#endif
57#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
59#endif
60#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
62#endif
63
68
69 emit setSlotDescription("translate(int,Vector)",tr("Translate object by given vector."),
70 QString(tr("objectId,Vector")).split(","), QString(tr("ID of an object, translation vector")).split(","));
71
72 emit setSlotDescription("translate(int,idList,Vector)",tr("Translate vertices by given vector."),
73 QString(tr("objectId,VertexHandles,Vector")).split(","),
74 QString(tr("ID of an object, List of vertex handles, translation vector")).split(","));
75
76 emit setSlotDescription("translateVertexSelection(int,Vector)",tr("Translate current vertex selection of an object by given vector."),
77 QString(tr("objectId,Vector")).split(","), QString(tr("ID of an object, translation vector")).split(","));
78
79 emit setSlotDescription("translateFaceSelection(int,Vector)",tr("Translate current face selection of an object by given vector."),
80 QString(tr("objectId,Vector")).split(","), QString(tr("ID of an object, translation vector")).split(","));
81
82 emit setSlotDescription("translateEdgeSelection(int,Vector)",tr("Translate current edge selection of an object by given vector."),
83 QString(tr("objectId,Vector")).split(","), QString(tr("ID of an object, translation vector")).split(","));
84
85 emit setSlotDescription("transformHandleRegion(int,Matrix4x4)",tr("Transform handle region using the specified matrix."),
86 QString(tr("objectId,Matrix")).split(","), QString(tr("ID of an object, transformation matrix")).split(","));
87
88 emit setSlotDescription("transform(int,Matrix4x4)",tr("transform object by given matrix."),
89 QString(tr("objectId,Matrix")).split(","), QString(tr("ID of an object, transformation matrix")).split(","));
90
91 emit setSlotDescription("transform(int,IdList,Matrix4x4)",tr("transform vertices by given matrix."),
92 QString(tr("objectId,VertexHandles,Matrix")).split(","),
93 QString(tr("ID of an object, List of vertex handles, transformation matrix")).split(","));
94
95 emit setSlotDescription("transformSelection(int,Matrix4x4)",tr("transform current selection of an object by given matrix."),
96 QString(tr("objectId,Matrix")).split(","), QString(tr("ID of an object, transformation matrix")).split(","));
97
98 emit setSlotDescription("transformCellSelection(int,Matrix4x4)",tr("transform selected cells by given matrix."),
99 QString(tr("objectId,Matrix")).split(","),
100 QString(tr("ID of an object, transformation matrix")).split(","));
101
102 emit setSlotDescription("transformVertexSelection(int,Matrix4x4)",tr("transform selected vertices by given matrix."),
103 QString(tr("objectId,Matrix")).split(","),
104 QString(tr("ID of an object, transformation matrix")).split(","));
105
106 emit setSlotDescription("transformFaceSelection(int,Matrix4x4)",tr("transform selected faces by given matrix."),
107 QString(tr("objectId,Matrix")).split(","),
108 QString(tr("ID of an object, transformation matrix")).split(","));
109
110 emit setSlotDescription("transformEdgeSelection(int,Matrix4x4)",tr("transform selected edges by given matrix."),
111 QString(tr("objectId,Matrix")).split(","),
112 QString(tr("ID of an object, transformation matrix")).split(","));
113
114 emit setSlotDescription("setManipulatorPosition(int,Vector)",tr("Set the position of the manipulator."),
115 QString(tr("objectId,Position")).split(","), QString(tr("ID of an object, 3D point")).split(","));
116
117 emit setSlotDescription("setManipulatorDirection(int,Vector, Vector)",tr("Set the direction of the manipulator."),
118 QString(tr("objectId,Direction, Direction")).split(","), QString(tr("ID of an object, x-direction, y-direction")).split(","));
119
120 emit setSlotDescription("manipulatorPosition(int)",tr("Returns the position of an object's manipulator."),
121 QStringList(tr("objectId")), QStringList(tr("ID of an object")));
122
123 emit setSlotDescription("manipulatorDirectionX(int)",tr("Returns the x-direction of an object's manipulator."),
124 QStringList(tr("objectId")), QStringList(tr("ID of an object")));
125
126 emit setSlotDescription("manipulatorDirectionY(int)",tr("Returns the y-direction of an object's manipulator."),
127 QStringList(tr("objectId")), QStringList(tr("ID of an object")));
128
129 emit setSlotDescription("manipulatorDirectionZ(int)",tr("Returns the z-direction of an object's manipulator."),
130 QStringList(tr("objectId")), QStringList(tr("ID of an object")));
131
132
133 emit setSlotDescription("objectRenderingMatrixIdentity(int)",tr("Resets the objects rendering matrix to identity."),
134 QStringList(tr("objectId")), QStringList(tr("ID of an object")));
135
136
137 emit setSlotDescription("objectRenderingMatrixScale(int,double)",tr("Adds a scaling factor to the Object rendering Matrix in the scenegraph."),
138 QStringList(tr("objectId;Scaling Factor").split(";")), QStringList(tr("ID of an object; Scaling factor").split(";")));
139
140 emit setSlotDescription("objectRenderingMatrixTranslate(int,Vector)",tr("Adds a translation to the Object rendering Matrix in the scenegraph."),
141 QStringList(tr("objectId;translation vector").split(";")), QStringList(tr("ID of an object;Translation vector").split(";")));
142
143 emit setSlotDescription("objectRenderingMatrixRotate(int,Vector,double)",tr("Adds a Rotation to the Object rendering Matrix in the scenegraph."),
144 QStringList(tr("objectId;rotation axis;angle").split(";")), QStringList(tr("ID of an object;Rotation axis;angle").split(";")));
145
146 emit setSlotDescription("getObjectRenderingMatrix(int)",tr("Returns the current object transformation matrix from the scenegraph."),
147 QStringList(tr("objectId").split(";")), QStringList(tr("ID of an object").split(";")));
148
149
150}
151
152
153//------------------------------------------------------------------------------
154
160void MovePlugin::translate( int _objectId , Vector _vector) {
161
162 BaseObjectData* object;
163 if ( ! PluginFunctions::getObject(_objectId,object) ) {
164 emit log(LOGERR,tr("translate : unable to get object") );
165 return;
166 }
167
168 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
169
170 TriMesh& mesh = (*PluginFunctions::triMesh(object));
171 for (auto v_it : mesh.vertices())
172 mesh.set_point(v_it,mesh.point(v_it) + _vector );
173
174 } else if ( object->dataType( DATA_POLY_MESH ) ) {
175
176 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
177 for (auto v_it : mesh.vertices())
178 mesh.set_point(v_it,mesh.point(v_it) + _vector );
179
180 }
181#ifdef ENABLE_TSPLINEMESH_SUPPORT
182 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
183
184 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
185 for (auto v_it : mesh.vertices())
186 mesh.set_point(v_it,mesh.point(v_it) + _vector );
187
188 }
189#endif
190#ifdef ENABLE_POLYLINE_SUPPORT
191 else if ( object->dataType(DATA_POLY_LINE) ) {
192
193 PolyLine& line = (* PluginFunctions::polyLine(object) );
194
195 for ( int i = 0 ; i < (int)line.n_vertices(); ++i )
196 line.point(i) = line.point(i) + _vector;
197 }
198#endif
199#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
200 else if ( object->dataType(DATA_HEXAHEDRAL_MESH) ) {
201
203 for (auto v_it : mesh.vertices())
204 mesh.set_vertex(v_it, mesh.vertex(v_it) + _vector );
205 }
206#endif
207#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
208 else if ( object->dataType(DATA_TETRAHEDRAL_MESH) ) {
209
211 for (auto v_it : mesh.vertices())
212 mesh.set_vertex(v_it, mesh.vertex(v_it) + _vector );
213 }
214#endif
215#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
216 else if ( object->dataType(DATA_POLYHEDRAL_MESH) ) {
217
219 for (auto v_it : mesh.vertices())
220 mesh.set_vertex(v_it, mesh.vertex(v_it) + _vector );
221 }
222#endif
223#ifdef ENABLE_BSPLINE_CURVE_SUPPORT
224 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
225 std::cerr << "Todo : translate BSplineCurve" << std::endl;
226 }
227#endif
228
229 emit updatedObject(_objectId, UPDATE_GEOMETRY);
230
231 emit scriptInfo( "translate( ObjectId , Vector(" +
232 QString::number( _vector[0] ) + " , " +
233 QString::number( _vector[1] ) + " , " +
234 QString::number( _vector[2] ) + " ) )" );
235}
236
237
238//------------------------------------------------------------------------------
239
246void MovePlugin::translate( int _objectId , IdList _vHandles, Vector _vector ){
247 BaseObjectData* object;
248 if ( ! PluginFunctions::getObject(_objectId,object) ) {
249 emit log(LOGERR,tr("translate : unable to get object") );
250 return;
251 }
252
253 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
254
255 TriMesh& mesh = (*PluginFunctions::triMesh(object));
256
257 for (uint i=0; i < _vHandles.size(); i++){
258 TriMesh::VertexHandle vh( _vHandles[i] );
259 mesh.set_point(vh ,mesh.point( vh ) + _vector );
260 }
261
262 } else if ( object->dataType( DATA_POLY_MESH ) ) {
263
264 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
265
266 for (uint i=0; i < _vHandles.size(); i++){
267 PolyMesh::VertexHandle vh( _vHandles[i] );
268 mesh.set_point(vh ,mesh.point( vh ) + _vector );
269 }
270 }
271#ifdef ENABLE_TSPLINEMESH_SUPPORT
272 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
273
274 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
275
276 for (uint i=0; i < _vHandles.size(); i++){
277 TSplineMesh::VertexHandle vh( _vHandles[i] );
278 mesh.set_point(vh ,mesh.point( vh ) + _vector );
279 }
280 }
281#endif
282#ifdef ENABLE_POLYLINE_SUPPORT
283 else if ( object->dataType(DATA_POLY_LINE) ) {
284
285 PolyLine& line = (* PluginFunctions::polyLine(object) );
286
287 const int max = line.n_vertices();
288
289 for ( unsigned int i = 0 ; i < _vHandles.size(); ++i )
290 if ( (_vHandles[i] > 0) && ( _vHandles[i] < max ) )
291 line.point( _vHandles[i] ) = line.point( _vHandles[i] ) + _vector;
292 }
293#endif
294#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
295 else if ( object->dataType(DATA_HEXAHEDRAL_MESH) ) {
296
298 for (unsigned int i = 0; i < _vHandles.size(); ++i) {
299 OpenVolumeMesh::VertexHandle v(_vHandles[i]);
300 mesh.set_vertex(v, mesh.vertex(v) + _vector );
301 }
302 }
303#endif
304#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
305 else if ( object->dataType(DATA_TETRAHEDRAL_MESH) ) {
306
308 for (unsigned int i = 0; i < _vHandles.size(); ++i) {
309 OpenVolumeMesh::VertexHandle v(_vHandles[i]);
310 mesh.set_vertex(v, mesh.vertex(v) + _vector );
311 }
312 }
313#endif
314#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
315 else if ( object->dataType(DATA_POLYHEDRAL_MESH) ) {
316
318 for (unsigned int i = 0; i < _vHandles.size(); ++i) {
319 OpenVolumeMesh::VertexHandle v(_vHandles[i]);
320 mesh.set_vertex(v, mesh.vertex(v) + _vector );
321 }
322 }
323#endif
324#ifdef ENABLE_BSPLINE_CURVE_SUPPORT
325 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
326 std::cerr << "Todo : translate BSplineCurve" << std::endl;
327 }
328#endif
329
330 emit updatedObject(_objectId, UPDATE_GEOMETRY);
331
332 emit scriptInfo( "translate( ObjectId , Vector(" +
333 QString::number( _vector[0] ) + " , " +
334 QString::number( _vector[1] ) + " , " +
335 QString::number( _vector[2] ) + " ) )" );
336
337}
338
339
340//------------------------------------------------------------------------------
341
347void MovePlugin::translateVertexSelection( int _objectId , Vector _vector) {
348
349 BaseObjectData* object;
350 if ( ! PluginFunctions::getObject(_objectId,object) ) {
351 emit log(LOGERR,tr("translate : unable to get object" ));
352 return;
353 }
354
355 bool noneSelected = true;
356
357 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
358
359 TriMesh& mesh = (*PluginFunctions::triMesh(object));
360 for (auto v_it : mesh.vertices())
361 if ( mesh.status(v_it).selected() ) {
362 noneSelected = false;
363 mesh.set_point(v_it,mesh.point(v_it) + _vector );
364 }
365
366 } else if ( object->dataType( DATA_POLY_MESH ) ) {
367
368 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
369 for (auto v_it : mesh.vertices())
370 if ( mesh.status(v_it).selected() ) {
371 noneSelected = false;
372 mesh.set_point(v_it,mesh.point(v_it) + _vector );
373 }
374 }
375#ifdef ENABLE_TSPLINEMESH_SUPPORT
376 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
377
378 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
379 for (auto v_it : mesh.vertices())
380 if ( mesh.status(v_it).selected() ) {
381 noneSelected = false;
382 mesh.set_point(v_it,mesh.point(v_it) + _vector );
383 }
384 }
385#endif
386#ifdef ENABLE_POLYLINE_SUPPORT
387 else if ( object->dataType(DATA_POLY_LINE) ) {
388
389 PolyLine& line = (* PluginFunctions::polyLine(object) );
390
391 for ( int i = 0 ; i < (int)line.n_vertices(); ++i )
392 if ( line.vertex_selection(i) ) {
393 noneSelected = false;
394 line.point(i) = line.point(i) + _vector;
395 }
396 }
397#endif
398#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
399 else if ( object->dataType(DATA_HEXAHEDRAL_MESH) ) {
400
402 OpenVolumeMesh::StatusAttrib& statusAttrib = ((HexahedralMeshObject*)object)->status();
403 for (auto v_it : mesh.vertices())
404 if (statusAttrib[v_it].selected()) {
405 noneSelected = false;
406 mesh.set_vertex(v_it, mesh.vertex(v_it) + _vector );
407 }
408 }
409#endif
410#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
411 else if ( object->dataType(DATA_TETRAHEDRAL_MESH) ) {
412
414 OpenVolumeMesh::StatusAttrib& statusAttrib = ((TetrahedralMeshObject*)object)->status();
415 for (auto v_it : mesh.vertices())
416 if (statusAttrib[v_it].selected()) {
417 noneSelected = false;
418 mesh.set_vertex(v_it, mesh.vertex(v_it) + _vector );
419 }
420 }
421#endif
422#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
423 else if ( object->dataType(DATA_POLYHEDRAL_MESH) ) {
424
426 OpenVolumeMesh::StatusAttrib& statusAttrib = ((PolyhedralMeshObject*)object)->status();
427 for (auto v_it : mesh.vertices())
428 if (statusAttrib[v_it].selected()) {
429 noneSelected = false;
430 mesh.set_vertex(v_it, mesh.vertex(v_it) + _vector );
431 }
432 }
433#endif
434#ifdef ENABLE_BSPLINE_CURVE_SUPPORT
435 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
436 std::cerr << "Todo : translate BSplineCurve" << std::endl;
437 }
438#endif
439
440 if (noneSelected)
441 return;
442
443 emit updatedObject(_objectId, UPDATE_GEOMETRY);
444
445 emit scriptInfo( "translate( ObjectId , Vector(" +
446 QString::number( _vector[0] ) + " , " +
447 QString::number( _vector[1] ) + " , " +
448 QString::number( _vector[2] ) + " ) )" );
449}
450
451
452//------------------------------------------------------------------------------
453
459void MovePlugin::translateFaceSelection( int _objectId , Vector _vector) {
460
461 BaseObjectData* object;
462 if ( ! PluginFunctions::getObject(_objectId,object) ) {
463 emit log(LOGERR,tr("translate : unable to get object" ));
464 return;
465 }
466
467 bool noneSelected = true;
468
469 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
470
471 TriMesh& mesh = (*PluginFunctions::triMesh(object));
472
473 // clear tags
474 for (auto v_it : mesh.vertices())
475 mesh.status(v_it).set_tagged(false);
476
477 for (auto f_it : mesh.faces())
478 if ( mesh.status(f_it).selected() )
479 {
480 for(auto fv_it : f_it.vertices()) {
481 noneSelected = false;
482 mesh.status(fv_it).set_tagged(true);
483 }
484 }
485
486 if (noneSelected)
487 return;
488
489 for (auto v_it : mesh.vertices())
490 if ( mesh.status(v_it).tagged() )
491 mesh.set_point(v_it,mesh.point(v_it) + _vector );
492
493 } else if ( object->dataType( DATA_POLY_MESH ) ) {
494
495 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
496
497 // clear tags
498 for (auto v_it : mesh.vertices())
499 mesh.status(v_it).set_tagged(false);
500
501 for (auto f_it : mesh.faces())
502 if ( mesh.status(f_it).selected() )
503 {
504 for(auto fv_it : f_it.vertices()) {
505 noneSelected = false;
506 mesh.status(fv_it).set_tagged(true);
507 }
508 }
509
510 if (noneSelected)
511 return;
512
513 for (auto v_it : mesh.vertices())
514 if ( mesh.status(v_it).tagged() )
515 mesh.set_point(v_it,mesh.point(v_it) + _vector );
516 }
517#ifdef ENABLE_TSPLINEMESH_SUPPORT
518 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
519
520 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
521
522 // clear tags
523 for (auto v_it : mesh.vertices())
524 mesh.status(v_it).set_tagged(false);
525
526 for (auto f_it : mesh.faces())
527 if ( mesh.status(f_it).selected() )
528 {
529 for(auto fv_it : f_it.vertices()) {
530 noneSelected = false;
531 mesh.status(fv_it).set_tagged(true);
532 }
533 }
534
535 if (noneSelected)
536 return;
537
538 for (auto v_it : mesh.vertices())
539 if ( mesh.status(v_it).tagged() )
540 mesh.set_point(v_it,mesh.point(v_it) + _vector );
541 }
542#endif
543
544 #ifdef ENABLE_POLYLINE_SUPPORT
545 else if ( object->dataType(DATA_POLY_LINE) ) {
546
547 PolyLine& line = (* PluginFunctions::polyLine(object) );
548
549 for ( int i = 0 ; i < (int)line.n_vertices(); ++i )
550 if ( line.vertex_selection(i) ) {
551 noneSelected = false;
552 line.point(i) = line.point(i) + _vector;
553 }
554
555 if (noneSelected)
556 return;
557 }
558 #endif
559 #ifdef ENABLE_BSPLINE_CURVE_SUPPORT
560 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
561 std::cerr << "Todo : translate BSplineCurve" << std::endl;
562 }
563 #endif
564
565 emit updatedObject(_objectId, UPDATE_GEOMETRY);
566
567 emit scriptInfo( "translate( ObjectId , Vector(" +
568 QString::number( _vector[0] ) + " , " +
569 QString::number( _vector[1] ) + " , " +
570 QString::number( _vector[2] ) + " ) )" );
571
572}
573
574
575//------------------------------------------------------------------------------
576
582void MovePlugin::translateEdgeSelection( int _objectId , Vector _vector) {
583
584 BaseObjectData* object;
585 if ( ! PluginFunctions::getObject(_objectId,object) ) {
586 emit log(LOGERR,tr("translate : unable to get object" ));
587 return;
588 }
589
590 bool noneSelected = true;
591
592 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
593
594 TriMesh& mesh = (*PluginFunctions::triMesh(object));
595
596 // clear tags
597 for (auto v_it : mesh.vertices())
598 mesh.status(v_it).set_tagged(false);
599
600 for (auto e_it : mesh.edges())
601 if ( mesh.status(e_it).selected() )
602 {
603 noneSelected = false;
604 OpenMesh::SmartHalfedgeHandle hh = e_it.h0();
605
606 mesh.status( hh.from() ).set_tagged(true);
607 mesh.status( hh.to() ).set_tagged(true);
608 }
609
610 if (noneSelected)
611 return;
612
613 for (auto v_it : mesh.vertices())
614 if ( mesh.status(v_it).tagged() ){
615 mesh.set_point(v_it,mesh.point(v_it) + _vector );
616 }
617
618 } else if ( object->dataType( DATA_POLY_MESH ) ) {
619
620 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
621
622 // clear tags
623 for (auto v_it : mesh.vertices())
624 mesh.status(v_it).set_tagged(false);
625
626 for (auto e_it : mesh.edges())
627 if ( mesh.status(e_it).selected() )
628 {
629 noneSelected = false;
630 OpenMesh::SmartHalfedgeHandle hh = e_it.h0();
631
632 mesh.status( hh.from() ).set_tagged(true);
633 mesh.status( hh.to() ).set_tagged(true);
634 }
635
636 if (noneSelected)
637 return;
638
639 for (auto v_it : mesh.vertices())
640 if ( mesh.status(v_it).tagged() ){
641 mesh.set_point(v_it,mesh.point(v_it) + _vector );
642 }
643 }
644#ifdef ENABLE_TSPLINEMESH_SUPPORT
645 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
646
647 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
648
649 // clear tags
650 for (auto v_it : mesh.vertices())
651 mesh.status(v_it).set_tagged(false);
652
653 for (auto e_it : mesh.edges())
654 if ( mesh.status(e_it).selected() )
655 {
656 noneSelected = false;
657 OpenMesh::SmartHalfedgeHandle hh = e_it.h0();
658
659 mesh.status( hh.from() ).set_tagged(true);
660 mesh.status( hh.to() ).set_tagged(true);
661 }
662
663 if (noneSelected)
664 return;
665
666 for (auto v_it : mesh.vertices())
667 if ( mesh.status(v_it).tagged() ){
668 mesh.set_point(v_it,mesh.point(v_it) + _vector );
669 }
670 }
671#endif
672
673 #ifdef ENABLE_POLYLINE_SUPPORT
674 else if ( object->dataType(DATA_POLY_LINE) ) {
675
676 PolyLine& line = (* PluginFunctions::polyLine(object) );
677
678 for ( int i = 0 ; i < (int)line.n_vertices(); ++i )
679 if ( line.vertex_selection(i) ) {
680 noneSelected = false;
681 line.point(i) = line.point(i) + _vector;
682 }
683
684 if (noneSelected)
685 return;
686 }
687 #endif
688 #ifdef ENABLE_BSPLINE_CURVE_SUPPORT
689 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
690 std::cerr << "Todo : translate BSplineCurve" << std::endl;
691 }
692 #endif
693
694 emit updatedObject(_objectId, UPDATE_GEOMETRY);
695
696 emit scriptInfo( "translate( ObjectId , Vector(" +
697 QString::number( _vector[0] ) + " , " +
698 QString::number( _vector[1] ) + " , " +
699 QString::number( _vector[2] ) + " ) )" );
700
701}
702//------------------------------------------------------------------------------
703
704void MovePlugin::transformHandleRegion(int _objectId, Matrix4x4 _matrix) {
705
706 BaseObjectData* object = NULL;
707 if (!PluginFunctions::getObject(_objectId, object)) {
708 emit log(LOGERR, tr("transformHandleRegion: Unable to get object!"));
709 return;
710 }
711
712 if(object->dataType(DATA_TRIANGLE_MESH)) {
713
714 TriMesh& mesh = (*PluginFunctions::triMesh(object));
715
717
718 } else if(object->dataType(DATA_POLY_MESH)) {
719
720 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
721
723 }
724
725 emit updatedObject(_objectId, UPDATE_GEOMETRY);
726}
727
728//------------------------------------------------------------------------------
729
735void MovePlugin::transform( int _objectId , Matrix4x4 _matrix ){
736
737 BaseObjectData* object;
738 if ( ! PluginFunctions::getObject(_objectId,object) ) {
739 emit log(LOGERR,tr("transform : unable to get object" ));
740 return;
741 }
742
743 Matrix4x4 normalMatrix = _matrix;
744 normalMatrix.invert();
745 normalMatrix.transpose();
746
747 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
748
749 TriMesh& mesh = (*PluginFunctions::triMesh(object));
750 for (auto v_it : mesh.vertices()){
751 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
752 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
753 }
754
755 } else if ( object->dataType( DATA_POLY_MESH ) ) {
756
757 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
758 for (auto v_it : mesh.vertices()){
759 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
760 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
761 }
762 }
763#ifdef ENABLE_TSPLINEMESH_SUPPORT
764 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
765
766 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
767 for (auto v_it : mesh.vertices()){
768 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
769 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
770 }
771 }
772#endif
773#ifdef ENABLE_POLYLINE_SUPPORT
774 else if ( object->dataType(DATA_POLY_LINE) ) {
775
776 PolyLine& line = (* PluginFunctions::polyLine(object) );
777
778 for ( int i = 0 ; i < (int)line.n_vertices(); ++i )
779 line.point(i) = _matrix.transform_point( line.point(i) );
780 }
781#endif
782#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
783 else if ( object->dataType(DATA_HEXAHEDRAL_MESH) ) {
784
786 OpenVolumeMesh::NormalAttrib<HexahedralMesh>& normalAttrib = ((HexahedralMeshObject*)object)->normals();
787 for (auto v_it : mesh.vertices()) {
788 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
789 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
790 }
791 }
792#endif
793#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
794 else if ( object->dataType(DATA_TETRAHEDRAL_MESH) ) {
795
797 OpenVolumeMesh::NormalAttrib<TetrahedralMesh>& normalAttrib = ((TetrahedralMeshObject*)object)->normals();
798 for (auto v_it : mesh.vertices()) {
799 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
800 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
801 }
802 }
803#endif
804#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
805 else if ( object->dataType(DATA_POLYHEDRAL_MESH) ) {
806
808 OpenVolumeMesh::NormalAttrib<PolyhedralMesh>& normalAttrib = ((PolyhedralMeshObject*)object)->normals();
809 for (auto v_it : mesh.vertices()) {
810 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
811 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
812 }
813 }
814#endif
815#ifdef ENABLE_BSPLINE_CURVE_SUPPORT
816 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
817 std::cerr << "Todo : transform BSplineCurve" << std::endl;
818 }
819#endif
820
821 emit updatedObject(_objectId, UPDATE_GEOMETRY);
822
823 QString matString;
824 for (int i=0; i < 4; i++)
825 for (int j=0; j < 4; j++)
826 matString += " , " + QString::number( _matrix(i,j) );
827
828 matString = matString.right( matString.length()-3 );
829
830 emit scriptInfo( "transform( ObjectId , Matrix4x4(" + matString + " ) )" );
831}
832
833
834//------------------------------------------------------------------------------
835
842void MovePlugin::transform( int _objectId , IdList _vHandles, Matrix4x4 _matrix ){
843
844 BaseObjectData* object;
845 if ( ! PluginFunctions::getObject(_objectId,object) ) {
846 emit log(LOGERR,tr("transform : unable to get object" ));
847 return;
848 }
849
850 Matrix4x4 normalMatrix = _matrix;
851 normalMatrix.invert();
852 normalMatrix.transpose();
853
854 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
855
856 TriMesh& mesh = (*PluginFunctions::triMesh(object));
857
858 for (uint i=0; i < _vHandles.size(); i++){
859 TriMesh::VertexHandle vh( _vHandles[i] );
860 mesh.set_point (vh, _matrix.transform_point ( mesh.point(vh) ) );
861 mesh.set_normal(vh, normalMatrix.transform_vector( mesh.normal(vh) ) );
862 }
863
864 } else if ( object->dataType( DATA_POLY_MESH ) ) {
865
866 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
867
868 for (uint i=0; i < _vHandles.size(); i++){
869 PolyMesh::VertexHandle vh( _vHandles[i] );
870 mesh.set_point (vh, _matrix.transform_point ( mesh.point(vh) ) );
871 mesh.set_normal(vh, normalMatrix.transform_vector( mesh.normal(vh) ) );
872 }
873 }
874#ifdef ENABLE_TSPLINEMESH_SUPPORT
875 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
876
877 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
878
879 for (uint i=0; i < _vHandles.size(); i++){
880 TSplineMesh::VertexHandle vh( _vHandles[i] );
881 mesh.set_point (vh, _matrix.transform_point ( mesh.point(vh) ) );
882 mesh.set_normal(vh, normalMatrix.transform_vector( mesh.normal(vh) ) );
883 }
884 }
885#endif
886#ifdef ENABLE_POLYLINE_SUPPORT
887 else if ( object->dataType(DATA_POLY_LINE) ) {
888
889 PolyLine& line = (* PluginFunctions::polyLine(object) );
890
891 const int max = line.n_vertices();
892
893 for ( unsigned int i = 0 ; i < _vHandles.size(); ++i )
894 if ( (_vHandles[i] > 0) && ( _vHandles[i] < max ) )
895 line.point( _vHandles[i] ) = _matrix.transform_point( line.point( _vHandles[i] ) );
896
897 }
898#endif
899#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
900 else if ( object->dataType(DATA_HEXAHEDRAL_MESH) ) {
901
903 OpenVolumeMesh::NormalAttrib<HexahedralMesh>& normalAttrib = ((HexahedralMeshObject*)object)->normals();
904 for (unsigned int i = 0; i < _vHandles.size(); ++i) {
905 OpenVolumeMesh::VertexHandle v(_vHandles[i]);
906 mesh.set_vertex(v, _matrix.transform_point ( mesh.vertex(v) ) );
907 normalAttrib[v] = normalMatrix.transform_vector( normalAttrib[v] );
908 }
909 }
910#endif
911#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
912 else if ( object->dataType(DATA_TETRAHEDRAL_MESH) ) {
913
915 OpenVolumeMesh::NormalAttrib<TetrahedralMesh>& normalAttrib = ((TetrahedralMeshObject*)object)->normals();
916 for (unsigned int i = 0; i < _vHandles.size(); ++i) {
917 OpenVolumeMesh::VertexHandle v(_vHandles[i]);
918 mesh.set_vertex(v, _matrix.transform_point ( mesh.vertex(v) ) );
919 normalAttrib[v] = normalMatrix.transform_vector( normalAttrib[v] );
920 }
921 }
922#endif
923#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
924 else if ( object->dataType(DATA_POLYHEDRAL_MESH) ) {
925
927 OpenVolumeMesh::NormalAttrib<PolyhedralMesh>& normalAttrib = ((PolyhedralMeshObject*)object)->normals();
928 for (unsigned int i = 0; i < _vHandles.size(); ++i) {
929 OpenVolumeMesh::VertexHandle v(_vHandles[i]);
930 mesh.set_vertex(v, _matrix.transform_point ( mesh.vertex(v) ) );
931 normalAttrib[v] = normalMatrix.transform_vector( normalAttrib[v] );
932 }
933 }
934#endif
935#ifdef ENABLE_BSPLINE_CURVE_SUPPORT
936 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
937 std::cerr << "Todo : transform BSplineCurve" << std::endl;
938 }
939#endif
940
941 emit updatedObject(_objectId, UPDATE_GEOMETRY);
942
943 QString matString;
944 for (int i=0; i < 4; i++)
945 for (int j=0; j < 4; j++)
946 matString += " , " + QString::number( _matrix(i,j) );
947
948 matString = matString.right( matString.length()-3 );
949
950 emit scriptInfo( "transform( ObjectId , Matrix4x4(" + matString + " ) )" );
951
952}
953
954
955//------------------------------------------------------------------------------
956
964bool MovePlugin::transformVertexSelection( int _objectId , Matrix4x4 _matrix ){
965 BaseObjectData* object;
966 if ( ! PluginFunctions::getObject(_objectId,object) ) {
967 emit log(LOGERR,tr("transform : unable to get object") );
968 return false;
969 }
970
971 Matrix4x4 normalMatrix = _matrix;
972 normalMatrix.invert();
973 normalMatrix.transpose();
974
975 bool noneSelected = true;
976 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
977
978 TriMesh& mesh = (*PluginFunctions::triMesh(object));
979 for (auto v_it : mesh.vertices())
980 if ( mesh.status(v_it).selected() )
981 {
982 noneSelected = false;
983 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
984 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
985 }
986
987 } else if ( object->dataType( DATA_POLY_MESH ) ) {
988
989 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
990 for (auto v_it : mesh.vertices())
991 if ( mesh.status(v_it).selected() )
992 {
993 noneSelected = false;
994 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
995 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
996 }
997 }
998#ifdef ENABLE_TSPLINEMESH_SUPPORT
999 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
1000
1001 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
1002 for (auto v_it : mesh.vertices())
1003 if ( mesh.status(v_it).selected() )
1004 {
1005 noneSelected = false;
1006 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1007 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1008 }
1009 }
1010#endif
1011#ifdef ENABLE_POLYLINE_SUPPORT
1012 else if ( object->dataType(DATA_POLY_LINE) ) {
1013
1014 PolyLine& line = (* PluginFunctions::polyLine(object) );
1015
1016 for ( int i = 0 ; i < (int)line.n_vertices(); ++i )
1017 if ( line.vertex_selection(i) ) {
1018 noneSelected = false;
1019 line.point(i) = _matrix.transform_point( line.point(i) );
1020 }
1021 }
1022#endif
1023#ifdef ENABLE_BSPLINE_CURVE_SUPPORT
1024 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
1025 std::cerr << "Todo : transform BSplineCurve" << std::endl;
1026 }
1027#endif
1028#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
1029 else if ( object->dataType(DATA_HEXAHEDRAL_MESH) ) {
1031 OpenVolumeMesh::NormalAttrib<HexahedralMesh>& normalAttrib = ((HexahedralMeshObject*)object)->normals();
1032 OpenVolumeMesh::StatusAttrib& statusAttrib = ((HexahedralMeshObject*)object)->status();
1033 for (auto v_it : mesh.vertices())
1034 if ( statusAttrib[v_it].selected() )
1035 {
1036 noneSelected = false;
1037 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1038 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1039 }
1040 }
1041#endif
1042#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
1043 else if ( object->dataType(DATA_TETRAHEDRAL_MESH) ) {
1045 OpenVolumeMesh::NormalAttrib<TetrahedralMesh>& normalAttrib = ((TetrahedralMeshObject*)object)->normals();
1046 OpenVolumeMesh::StatusAttrib& statusAttrib = ((TetrahedralMeshObject*)object)->status();
1047 for (auto v_it : mesh.vertices())
1048 if ( statusAttrib[v_it].selected() )
1049 {
1050 noneSelected = false;
1051 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1052 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1053 }
1054 }
1055#endif
1056#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
1057 else if ( object->dataType(DATA_POLYHEDRAL_MESH) ) {
1059 OpenVolumeMesh::NormalAttrib<PolyhedralMesh>& normalAttrib = ((PolyhedralMeshObject*)object)->normals();
1060 OpenVolumeMesh::StatusAttrib& statusAttrib = ((PolyhedralMeshObject*)object)->status();
1061 for (auto v_it : mesh.vertices())
1062 if ( statusAttrib[v_it].selected() )
1063 {
1064 noneSelected = false;
1065 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1066 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1067 }
1068 }
1069#endif
1070
1071 if (noneSelected)
1072 return false;
1073
1074 emit updatedObject(_objectId, UPDATE_GEOMETRY);
1075
1076 QString matString;
1077 for (int i=0; i < 4; i++)
1078 for (int j=0; j < 4; j++)
1079 matString += " , " + QString::number( _matrix(i,j) );
1080
1081 matString = matString.right( matString.length()-3 );
1082
1083 emit scriptInfo( "transformVertexSelection( ObjectId , Matrix4x4(" + matString + " ) )" );
1084
1085 return true;
1086}
1087
1088
1089//------------------------------------------------------------------------------
1090
1098bool MovePlugin::transformFaceSelection( int _objectId , Matrix4x4 _matrix ){
1099 BaseObjectData* object;
1100 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1101 emit log(LOGERR,tr("transform : unable to get object") );
1102 return false;
1103 }
1104
1105 Matrix4x4 normalMatrix = _matrix;
1106 normalMatrix.invert();
1107 normalMatrix.transpose();
1108
1109 bool noneSelected = true;
1110 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
1111
1112 TriMesh& mesh = (*PluginFunctions::triMesh(object));
1113
1114 //init tags
1115 for (auto v_it : mesh.vertices())
1116 mesh.status(v_it).set_tagged(false);
1117
1118 for (auto f_it : mesh.faces())
1119 if ( mesh.status(f_it).selected() )
1120 {
1121 noneSelected = false;
1122 for(auto fv_it : f_it.vertices())
1123 mesh.status(fv_it).set_tagged(true);
1124 }
1125
1126 for (auto v_it : mesh.vertices())
1127 if ( mesh.status(v_it).tagged() ){
1128 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1129 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1130 }
1131
1132 } else if ( object->dataType( DATA_POLY_MESH ) ) {
1133
1134 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
1135
1136 //init tags
1137 for (auto v_it : mesh.vertices())
1138 mesh.status(v_it).set_tagged(false);
1139
1140 for (auto f_it : mesh.faces())
1141 if ( mesh.status(f_it).selected() )
1142 {
1143 noneSelected = false;
1144 for(auto fv_it : f_it.vertices())
1145 mesh.status(fv_it).set_tagged(true);
1146 }
1147
1148 for (auto v_it : mesh.vertices())
1149 if ( mesh.status(v_it).tagged() ){
1150 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1151 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1152 }
1153 }
1154#ifdef ENABLE_TSPLINEMESH_SUPPORT
1155 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
1156
1157 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
1158
1159 //init tags
1160 for (auto v_it : mesh.vertices())
1161 mesh.status(v_it).set_tagged(false);
1162
1163 for (auto f_it : mesh.faces())
1164 if ( mesh.status(f_it).selected() )
1165 {
1166 noneSelected = false;
1167 for(auto fv_it : f_it.verices())
1168 mesh.status(fv_it).set_tagged(true);
1169 }
1170
1171 for (auto v_it : mesh.vertices())
1172 if ( mesh.status(v_it).tagged() ){
1173 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1174 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1175 }
1176 }
1177#endif
1178#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
1179 if ( object->dataType( DATA_HEXAHEDRAL_MESH ) ) {
1180
1182 OpenVolumeMesh::NormalAttrib<HexahedralMesh>& normalAttrib = ((HexahedralMeshObject*)object)->normals();
1183 OpenVolumeMesh::StatusAttrib& statusAttrib = ((HexahedralMeshObject*)object)->status();
1184
1185 //init tags
1186 for (auto v_it : mesh.vertices())
1187 statusAttrib[v_it].set_tagged(false);
1188
1189
1190 for (auto f_it : mesh.faces())
1191 if ( statusAttrib[f_it].selected() )
1192 {
1193 noneSelected = false;
1194 for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mesh.hfv_iter(mesh.halfface_handle(f_it,0)); hfv_it.valid(); ++hfv_it)
1195 statusAttrib[*hfv_it].set_tagged(true);
1196 }
1197
1198 for (auto v_it : mesh.vertices())
1199 if ( statusAttrib[v_it].tagged() )
1200 {
1201 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1202 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1203 }
1204
1205 }
1206#endif
1207#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
1208 if ( object->dataType( DATA_TETRAHEDRAL_MESH ) ) {
1209
1211 OpenVolumeMesh::NormalAttrib<TetrahedralMesh>& normalAttrib = ((TetrahedralMeshObject*)object)->normals();
1212 OpenVolumeMesh::StatusAttrib& statusAttrib = ((TetrahedralMeshObject*)object)->status();
1213
1214 //init tags
1215 for (auto v_it : mesh.vertices())
1216 statusAttrib[v_it].set_tagged(false);
1217
1218 for (auto f_it : mesh.faces())
1219 if ( statusAttrib[f_it].selected() )
1220 {
1221 noneSelected = false;
1222 for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mesh.hfv_iter(mesh.halfface_handle(f_it,0)); hfv_it.valid(); ++hfv_it)
1223 statusAttrib[*hfv_it].set_tagged(true);
1224 }
1225
1226 for (auto v_it : mesh.vertices())
1227 if ( statusAttrib[v_it].tagged() )
1228 {
1229 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1230 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1231 }
1232
1233 }
1234#endif
1235#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
1236 else if ( object->dataType( DATA_POLYHEDRAL_MESH ) ) {
1237
1239 OpenVolumeMesh::NormalAttrib<PolyhedralMesh>& normalAttrib = ((PolyhedralMeshObject*)object)->normals();
1240 OpenVolumeMesh::StatusAttrib& statusAttrib = ((PolyhedralMeshObject*)object)->status();
1241
1242 //init tags
1243 for (auto v_it : mesh.vertices())
1244 statusAttrib[v_it].set_tagged(false);
1245
1246 for (auto f_it : mesh.faces())
1247 if ( statusAttrib[f_it].selected() )
1248 {
1249 noneSelected = false;
1250 for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mesh.hfv_iter(mesh.halfface_handle(f_it,0)); hfv_it.valid(); ++hfv_it)
1251 statusAttrib[*hfv_it].set_tagged(true);
1252 }
1253
1254 for (auto v_it : mesh.vertices())
1255 if ( statusAttrib[v_it].tagged() )
1256 {
1257 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1258 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1259 }
1260 }
1261#endif
1262
1263 if (noneSelected)
1264 return false;
1265
1266 emit updatedObject(_objectId, UPDATE_GEOMETRY);
1267
1268 QString matString;
1269 for (int i=0; i < 4; i++)
1270 for (int j=0; j < 4; j++)
1271 matString += " , " + QString::number( _matrix(i,j) );
1272
1273 matString = matString.right( matString.length()-3 );
1274
1275 emit scriptInfo( "transformFaceSelection( ObjectId , Matrix4x4(" + matString + " ) )" );
1276
1277 return true;
1278}
1279
1280
1281//------------------------------------------------------------------------------
1282
1290bool MovePlugin::transformEdgeSelection( int _objectId , Matrix4x4 _matrix ){
1291 BaseObjectData* object;
1292 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1293 emit log(LOGERR,tr("transform : unable to get object" ) );
1294 return false;
1295 }
1296
1297 Matrix4x4 normalMatrix = _matrix;
1298 normalMatrix.invert();
1299 normalMatrix.transpose();
1300
1301 bool noneSelected = true;
1302 if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
1303
1304 TriMesh& mesh = (*PluginFunctions::triMesh(object));
1305
1306 //init tags
1307 for (auto v_it : mesh.vertices())
1308 mesh.status(v_it).set_tagged(false);
1309
1310 for (auto e_it : mesh.edges())
1311 if ( mesh.status(e_it).selected() )
1312 {
1313 noneSelected = false;
1314 OpenMesh::SmartHalfedgeHandle hh = e_it.h0();
1315
1316 mesh.status( hh.from() ).set_tagged(true);
1317 mesh.status( hh.to() ).set_tagged(true);
1318 }
1319
1320 for (auto v_it : mesh.vertices())
1321 if ( mesh.status(v_it).tagged() ){
1322 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1323 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1324 }
1325
1326 } else if ( object->dataType( DATA_POLY_MESH ) ) {
1327
1328 PolyMesh& mesh = (*PluginFunctions::polyMesh(object));
1329
1330 //init tags
1331 for (auto v_it : mesh.vertices())
1332 mesh.status(v_it).set_tagged(false);
1333
1334 for (auto e_it : mesh.edges())
1335 if ( mesh.status(e_it).selected() )
1336 {
1337 noneSelected = false;
1338 OpenMesh::SmartHalfedgeHandle hh = e_it.h0();
1339
1340 mesh.status( hh.from() ).set_tagged(true);
1341 mesh.status( hh.to() ).set_tagged(true);
1342 }
1343
1344 for (auto v_it : mesh.vertices())
1345 if ( mesh.status(v_it).tagged() ){
1346 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1347 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1348 }
1349 }
1350#ifdef ENABLE_TSPLINEMESH_SUPPORT
1351 else if ( object->dataType( DATA_TSPLINE_MESH ) ) {
1352
1353 TSplineMesh& mesh = (*PluginFunctions::tsplineMesh(object));
1354
1355 //init tags
1356 for (auto v_it : mesh.vertices())
1357 mesh.status(v_it).set_tagged(false);
1358
1359 for (auto e_it : mesh.edges())
1360 if ( mesh.status(e_it).selected() )
1361 {
1362 noneSelected = false;
1363 OpenMesh::SmartHalfedgeHandle hh = e_it.h0();
1364
1365 mesh.status( hh.from() ).set_tagged(true);
1366 mesh.status( hh.to() ).set_tagged(true);
1367 }
1368
1369 for (auto v_it : mesh.vertices())
1370 if ( mesh.status(v_it).tagged() ){
1371 mesh.set_point (v_it, _matrix.transform_point ( mesh.point(v_it) ) );
1372 mesh.set_normal(v_it, normalMatrix.transform_vector( mesh.normal(v_it) ) );
1373 }
1374 }
1375#endif
1376#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
1377 if ( object->dataType( DATA_HEXAHEDRAL_MESH ) ) {
1378
1380 OpenVolumeMesh::NormalAttrib<HexahedralMesh>& normalAttrib = ((HexahedralMeshObject*)object)->normals();
1381 OpenVolumeMesh::StatusAttrib& statusAttrib = ((HexahedralMeshObject*)object)->status();
1382
1383 //init tags
1384 for (auto v_it : mesh.vertices())
1385 statusAttrib[v_it].set_tagged(false);
1386
1387 for (auto e_it : mesh.edges())
1388 if ( statusAttrib[e_it].selected() )
1389 {
1390 noneSelected = false;
1391 OpenVolumeMesh::OpenVolumeMeshEdge e(mesh.edge(e_it));
1392 statusAttrib[e.from_vertex()].set_tagged(true);
1393 statusAttrib[e.to_vertex()].set_tagged(true);
1394 }
1395
1396 for (auto v_it : mesh.vertices())
1397 if ( statusAttrib[v_it].tagged() )
1398 {
1399 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1400 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1401 }
1402
1403 }
1404#endif
1405#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
1406 if ( object->dataType( DATA_TETRAHEDRAL_MESH ) ) {
1407
1409 OpenVolumeMesh::NormalAttrib<TetrahedralMesh>& normalAttrib = ((TetrahedralMeshObject*)object)->normals();
1410 OpenVolumeMesh::StatusAttrib& statusAttrib = ((TetrahedralMeshObject*)object)->status();
1411
1412 //init tags
1413 for (auto v_it : mesh.vertices())
1414 statusAttrib[v_it].set_tagged(false);
1415
1416 for (auto e_it : mesh.edges())
1417 if ( statusAttrib[e_it].selected() )
1418 {
1419 noneSelected = false;
1420 OpenVolumeMesh::OpenVolumeMeshEdge e(mesh.edge(e_it));
1421 statusAttrib[e.from_vertex()].set_tagged(true);
1422 statusAttrib[e.to_vertex()].set_tagged(true);
1423 }
1424
1425 for (auto v_it : mesh.vertices())
1426 if ( statusAttrib[v_it].tagged() )
1427 {
1428 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1429 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1430 }
1431
1432 }
1433#endif
1434#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
1435 if ( object->dataType( DATA_POLYHEDRAL_MESH ) ) {
1436
1438 OpenVolumeMesh::NormalAttrib<PolyhedralMesh>& normalAttrib = ((PolyhedralMeshObject*)object)->normals();
1439 OpenVolumeMesh::StatusAttrib& statusAttrib = ((PolyhedralMeshObject*)object)->status();
1440
1441 //init tags
1442 for (auto v_it : mesh.vertices())
1443 statusAttrib[v_it].set_tagged(false);
1444
1445 for (auto e_it : mesh.edges())
1446 if ( statusAttrib[e_it].selected() )
1447 {
1448 noneSelected = false;
1449 OpenVolumeMesh::OpenVolumeMeshEdge e(mesh.edge(e_it));
1450 statusAttrib[e.from_vertex()].set_tagged(true);
1451 statusAttrib[e.to_vertex()].set_tagged(true);
1452 }
1453
1454 for (auto v_it : mesh.vertices())
1455 if ( statusAttrib[v_it].tagged() )
1456 {
1457 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1458 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1459 }
1460
1461 }
1462#endif
1463
1464 #ifdef ENABLE_POLYLINE_SUPPORT
1465 else if ( object->dataType(DATA_POLY_LINE) ) {
1466 std::cerr << "Todo : transform PolyLine" << std::endl;
1467 }
1468 #endif
1469 #ifdef ENABLE_BSPLINE_CURVE_SUPPORT
1470 else if ( object->dataType(DATA_BSPLINE_CURVE) ) {
1471 std::cerr << "Todo : transform BSplineCurve" << std::endl;
1472 }
1473 #endif
1474
1475 if (noneSelected)
1476 return false;
1477
1478 emit updatedObject(_objectId, UPDATE_GEOMETRY);
1479
1480 QString matString;
1481 for (int i=0; i < 4; i++)
1482 for (int j=0; j < 4; j++)
1483 matString += " , " + QString::number( _matrix(i,j) );
1484
1485 matString = matString.right( matString.length()-3 );
1486
1487 emit scriptInfo( "transformEdgeSelection( ObjectId , Matrix4x4(" + matString + " ) )" );
1488
1489 return true;
1490}
1491
1492//------------------------------------------------------------------------------
1493
1501bool MovePlugin::transformCellSelection( int _objectId , Matrix4x4 _matrix ){
1502 BaseObjectData* object;
1503 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1504 emit log(LOGERR,tr("transform : unable to get object") );
1505 return false;
1506 }
1507
1508 Matrix4x4 normalMatrix = _matrix;
1509 normalMatrix.invert();
1510 normalMatrix.transpose();
1511
1512 bool noneSelected = true;
1513
1514#ifdef ENABLE_HEXAHEDRALMESH_SUPPORT
1515 if ( object->dataType( DATA_HEXAHEDRAL_MESH ) ) {
1516
1518 OpenVolumeMesh::NormalAttrib<HexahedralMesh>& normalAttrib = ((HexahedralMeshObject*)object)->normals();
1519 OpenVolumeMesh::StatusAttrib& statusAttrib = ((HexahedralMeshObject*)object)->status();
1520
1521 //init tags
1522 for (auto v_it : mesh.vertices())
1523 statusAttrib[v_it].set_tagged(false);
1524
1525 for (auto c_it : mesh.cells())
1526 if ( statusAttrib[c_it].selected() )
1527 {
1528 noneSelected = false;
1529 for (OpenVolumeMesh::CellVertexIter cv_it = mesh.cv_iter(c_it); cv_it.valid(); ++cv_it)
1530 statusAttrib[*cv_it].set_tagged(true);
1531 }
1532
1533 for (auto v_it : mesh.vertices())
1534 if ( statusAttrib[v_it].tagged() )
1535 {
1536 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1537 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1538 }
1539
1540 }
1541#endif
1542#ifdef ENABLE_TETRAHEDRALMESH_SUPPORT
1543 if ( object->dataType( DATA_TETRAHEDRAL_MESH ) ) {
1544
1546 OpenVolumeMesh::NormalAttrib<TetrahedralMesh>& normalAttrib = ((TetrahedralMeshObject*)object)->normals();
1547 OpenVolumeMesh::StatusAttrib& statusAttrib = ((TetrahedralMeshObject*)object)->status();
1548
1549 //init tags
1550 for (auto v_it : mesh.vertices())
1551 statusAttrib[v_it].set_tagged(false);
1552
1553 for (auto c_it : mesh.cells())
1554 if ( statusAttrib[c_it].selected() )
1555 {
1556 noneSelected = false;
1557 for (OpenVolumeMesh::CellVertexIter cv_it = mesh.cv_iter(c_it); cv_it.valid(); ++cv_it)
1558 statusAttrib[*cv_it].set_tagged(true);
1559 }
1560
1561 for (auto v_it : mesh.vertices())
1562 if ( statusAttrib[v_it].tagged() )
1563 {
1564 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1565 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1566 }
1567
1568 }
1569#endif
1570#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
1571 else if ( object->dataType( DATA_POLYHEDRAL_MESH ) ) {
1572
1574 OpenVolumeMesh::NormalAttrib<PolyhedralMesh>& normalAttrib = ((PolyhedralMeshObject*)object)->normals();
1575 OpenVolumeMesh::StatusAttrib& statusAttrib = ((PolyhedralMeshObject*)object)->status();
1576
1577 //init tags
1578 for (auto v_it : mesh.vertices())
1579 statusAttrib[v_it].set_tagged(false);
1580
1581 for (auto c_it : mesh.cells())
1582 if ( statusAttrib[c_it].selected() )
1583 {
1584 noneSelected = false;
1585 for (OpenVolumeMesh::CellVertexIter cv_it = mesh.cv_iter(c_it); cv_it.valid(); ++cv_it)
1586 statusAttrib[*cv_it].set_tagged(true);
1587 }
1588
1589 for (auto v_it : mesh.vertices())
1590 if ( statusAttrib[v_it].tagged() )
1591 {
1592 mesh.set_vertex(v_it, _matrix.transform_point ( mesh.vertex(v_it) ) );
1593 normalAttrib[v_it] = normalMatrix.transform_vector( normalAttrib[v_it] );
1594 }
1595 }
1596#endif
1597
1598 if (noneSelected)
1599 return false;
1600
1601 emit updatedObject(_objectId, UPDATE_GEOMETRY);
1602
1603 QString matString;
1604 for (int i=0; i < 4; i++)
1605 for (int j=0; j < 4; j++)
1606 matString += " , " + QString::number( _matrix(i,j) );
1607
1608 matString = matString.right( matString.length()-3 );
1609
1610 emit scriptInfo( "transformCellSelection( ObjectId , Matrix4x4(" + matString + " ) )" );
1611
1612 return true;
1613}
1614
1615
1616//------------------------------------------------------------------------------
1617
1623void MovePlugin::setManipulatorPosition( int _objectId , Vector _position ){
1624
1625 BaseObjectData* object;
1626 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1627 emit log(LOGERR,tr("setManipulatorPosition : unable to get object") );
1628 return;
1629 }
1630
1631
1633
1634
1635 object->manipPlaced( true );
1636
1637 object->manipulatorNode()->loadIdentity();
1638 object->manipulatorNode()->set_center(_position);
1639 object->manipulatorNode()->set_draw_cylinder(true);
1640 object->manipulatorNode()->set_size(manip_size_ * manip_size_modifier_);
1641 object->manipulatorNode()->show();
1642
1643 connect(object->manipulatorNode() , SIGNAL(manipulatorMoved(QtTranslationManipulatorNode*,QMouseEvent*)),
1644 this , SLOT( manipulatorMoved(QtTranslationManipulatorNode*,QMouseEvent*)));
1645
1646 connect(object->manipulatorNode() , SIGNAL(positionChanged(QtTranslationManipulatorNode*)),
1648
1649 lastActiveManipulator_ = object->id();
1650
1651 emit updateView();
1652
1653 emit scriptInfo( "setManipulatorPosition( ObjectId , Vector(" +
1654 QString::number( _position[0] ) + " , " +
1655 QString::number( _position[1] ) + " , " +
1656 QString::number( _position[2] ) + " ) )" );
1657}
1658
1659
1660//------------------------------------------------------------------------------
1661
1668
1669 BaseObjectData* object;
1670 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1671 emit log(LOGERR,tr("manipulatorPosition : unable to get object" ));
1672 return Vector();
1673 }
1674
1675 return (Vector) object->manipulatorNode()->center();
1676}
1677
1678
1679//------------------------------------------------------------------------------
1680
1687void MovePlugin::setManipulatorDirection( int _objectId , Vector _directionX, Vector _directionY ){
1688
1689 BaseObjectData* object;
1690 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1691 emit log(LOGERR,tr("setManipulatorDirection : unable to get object") );
1692 return;
1693 }
1694
1695 if ( !object->manipPlaced() ){
1696 emit log(LOGERR,tr("setManipulatorDirection : manipulator position has to be set first" ));
1697 return;
1698 }
1699
1700 object->manipulatorNode()->set_direction(_directionX, _directionY);
1701
1702 emit scriptInfo( "setManipulatorDirection( ObjectId , Vector(" +
1703 QString::number( _directionX[0] ) + " , " +
1704 QString::number( _directionX[1] ) + " , " +
1705 QString::number( _directionX[2] ) + " ), Vector(" +
1706 QString::number( _directionY[0] ) + " , " +
1707 QString::number( _directionY[1] ) + " , " +
1708 QString::number( _directionY[2] ) + " ) )" );
1709}
1710
1711
1712//------------------------------------------------------------------------------
1713
1720
1721 BaseObjectData* object;
1722 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1723 emit log(LOGERR,tr("manipulatorDirection : unable to get object" ));
1724 return Vector();
1725 }
1726
1727 return (Vector) object->manipulatorNode()->directionX();
1728}
1729
1730
1731//------------------------------------------------------------------------------
1732
1739
1740 BaseObjectData* object;
1741 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1742 emit log(LOGERR,tr("manipulatorDirection : unable to get object" ));
1743 return Vector();
1744 }
1745
1746 return (Vector) object->manipulatorNode()->directionY();
1747}
1748
1749
1750//------------------------------------------------------------------------------
1751
1758
1759 BaseObjectData* object;
1760 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1761 emit log(LOGERR,tr("manipulatorDirection : unable to get object" ));
1762 return Vector();
1763 }
1764
1765 return (Vector) object->manipulatorNode()->directionZ();
1766}
1767
1768//------------------------------------------------------------------------------
1769
1771 BaseObjectData* object;
1772
1773 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1774 emit log(LOGERR,tr("objectRenderingMatrixIdentity : unable to get object" ));
1775 return ;
1776 }
1777
1778 object->manipulatorNode()->loadIdentity();
1779
1780 emit updatedObject(_objectId,UPDATE_VISIBILITY);
1781}
1782
1783//------------------------------------------------------------------------------
1784
1785void MovePlugin::objectRenderingMatrixScale(int _objectId, double _s) {
1786 BaseObjectData* object;
1787
1788 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1789 emit log(LOGERR,tr("objectRenderingMatrixScale : unable to get object" ));
1790 return ;
1791 }
1792
1793 object->manipulatorNode()->scale(_s);
1794
1795 emit updatedObject(_objectId,UPDATE_VISIBILITY);
1796}
1797
1798//------------------------------------------------------------------------------
1799
1800void MovePlugin::objectRenderingMatrixTranslate(int _objectId, Vector _translation) {
1801 BaseObjectData* object;
1802
1803 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1804 emit log(LOGERR,tr("objectRenderingMatrixTranslate : unable to get object" ));
1805 return ;
1806 }
1807
1808 object->manipulatorNode()->translate(_translation);
1809
1810 emit updatedObject(_objectId,UPDATE_VISIBILITY);
1811}
1812
1813//------------------------------------------------------------------------------
1814
1815void MovePlugin::objectRenderingMatrixRotate(int _objectId, Vector _axis, double _angle) {
1816 BaseObjectData* object;
1817
1818 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1819 emit log(LOGERR,tr("objectRenderingMatrixRotate : unable to get object" ));
1820 return ;
1821 }
1822
1823 object->manipulatorNode()->rotate(_angle,_axis);
1824
1825 emit updatedObject(_objectId,UPDATE_VISIBILITY);
1826}
1827
1828//------------------------------------------------------------------------------
1829
1831 BaseObjectData* object;
1832
1833 if ( ! PluginFunctions::getObject(_objectId,object) ) {
1834 emit log(LOGERR,tr("getObjectRenderingMatrix : unable to get object" ));
1835 return Matrix4x4();
1836 }
1837
1838 return object->manipulatorNode()->matrix();
1839}
1840
#define DATA_BSPLINE_CURVE
Definition: BSplineCurve.hh:67
ACG::Matrix4x4d Matrix4x4
Standard Type for a 4x4 Matrix used for scripting.
Definition: DataTypes.hh:183
ACG::Vec3d Vector
Standard Type for 3d Vector used for scripting.
Definition: DataTypes.hh:176
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition: DataTypes.hh:181
@ LOGERR
Functions for modifying a Mesh.
#define DATA_HEXAHEDRAL_MESH
#define DATA_POLYHEDRAL_MESH
#define DATA_TETRAHEDRAL_MESH
#define DATA_POLY_LINE
Definition: PolyLine.hh:64
#define DATA_POLY_MESH
Definition: PolyMesh.hh:59
#define DATA_TRIANGLE_MESH
Definition: TriangleMesh.hh:60
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
bool invert()
matrix inversion (returns true on success)
void transpose()
transpose matrix
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
size_t n_vertices() const
Get number of vertices.
Definition: PolyLineT.hh:119
Point & point(unsigned int _i)
Get a point of the polyline.
Definition: PolyLineT.hh:145
QtTranslationManipulatorNode * manipulatorNode()
bool manipPlaced()
Check if the manipulator has been placed.
bool dataType(DataType _type) const
Definition: BaseObject.cc:219
void objectRenderingMatrixTranslate(int _objectId, Vector _translation)
Adds a scaling factor to the Object rendering Matrix in the scenegraph.
void translateEdgeSelection(int _objectId, Vector _vector)
translate current edge selection of an Object by a given vector
void objectRenderingMatrixIdentity(int _objectId)
Sets the Object Matrix in the scenegraph to identity.
void setDescriptions()
Set Descriptions for scriptable functions.
Vector manipulatorDirectionX(int _objectId)
Get the x-direction of the manipulator.
bool transformCellSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
void translate(int _objectId, Vector _vector)
translate an Object by a given vector
Matrix4x4 getObjectRenderingMatrix(int _objectId)
Gets the Object Matrix in the scenegraph.
Vector manipulatorPosition(int _objectId)
Get the position of the manipulator.
double manip_size_modifier_
Modifier for the Size (changed by Mousewheel Events)
Definition: MovePlugin.hh:399
void objectRenderingMatrixRotate(int _objectId, Vector _axis, double _angle)
Adds a scaling factor to the Object rendering Matrix in the scenegraph.
void objectRenderingMatrixScale(int _objectId, double _s)
Adds a scaling factor to the Object rendering Matrix in the scenegraph.
bool transformVertexSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
Vector manipulatorDirectionY(int _objectId)
Get the y-direction of the manipulator.
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
Definition: MovePlugin.cc:836
bool transformEdgeSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
int lastActiveManipulator_
Stores the last manipulator which has been clicked ( used for the toolbox dialog)
Definition: MovePlugin.hh:402
Vector manipulatorDirectionZ(int _objectId)
Get the z-direction of the manipulator.
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
Definition: MovePlugin.cc:779
double manip_size_
Size for the manipulators.
Definition: MovePlugin.hh:396
void translateFaceSelection(int _objectId, Vector _vector)
translate current face selection of an Object by a given vector
void setManipulatorPosition(int _objectId, Vector _position)
Set the position of the manipulator.
void setManipulatorDirection(int _objectId, Vector _directionX, Vector _directionY)
Set the direction of the manipulator.
void transformHandleRegion(int _objectId, Matrix4x4 _matrix)
Transform handle region using the given transformation matrix.
void translateVertexSelection(int _objectId, Vector _vector)
translate current vertex selection of an Object by a given vector
void transform(int _objectId, Matrix4x4 _matrix)
transform an Object by a given matrix
bool transformFaceSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
const UpdateType UPDATE_VISIBILITY(UpdateTypeSet(2))
This is the update identifier for global Object visibility ( show/hide )
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
void transformHandleVertices(ACG::Matrix4x4d _matrix, MeshT &_mesh)
double sceneRadius()
Returns the current scene radius from the active examiner widget.
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
PolyhedralMesh * polyhedralMesh(BaseObjectData *_object)
Get an PolyhedralMesh from an object.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
HexahedralMesh * hexahedralMesh(BaseObjectData *_object)
Get an HexahedralMesh from an object.
TetrahedralMesh * tetrahedralMesh(BaseObjectData *_object)
Get an TetrahedralMesh from an object.
SmartVertexHandle from() const
Returns vertex at start of halfedge.
SmartVertexHandle to() const
Returns vertex pointed to by halfedge.