Developer Documentation

MeshObjectInfoScripting.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 "MeshObjectInfoPlugin.hh"
45
46 #include <MeshTools/MeshInfoT.hh>
47
48
49 //------------------------------------------------------------------------------
50
54 void InfoMeshObjectPlugin::setDescriptions(){
55
56 emit setSlotDescription("vertexCount(int)",tr("get total number of vertices for a given object"),
57 QStringList(tr("objectID")), QStringList(tr("id of an object")));
58
59 emit setSlotDescription("edgeCount(int)",tr("get total number of edges for a given object"),
60 QStringList(tr("objectID")), QStringList(tr("id of an object")));
61
62 emit setSlotDescription("faceCount(int)",tr("get total number of faces for a given object"),
63 QStringList(tr("objectID")), QStringList(tr("id of an object")));
64
65 emit setSlotDescription("boundaryCount(int)",tr("get number of boundaries for a given object"),
66 QStringList(tr("objectID")), QStringList(tr("id of an object")));
67
68 emit setSlotDescription("componentCount(int)",tr("get number of components for a given object"),
69 QStringList(tr("objectID")), QStringList(tr("id of an object")));
70
71 emit setSlotDescription("genus(int)",tr("get the genus of a given object"),
72 QStringList(tr("objectID")), QStringList(tr("id of an object")));
73
74 emit setSlotDescription("cog(int)",tr("get the center of gravity for a given object"),
75 QStringList(tr("objectID")), QStringList(tr("id of an object")));
76
77 emit setSlotDescription("boundingBoxMin(int)",tr("get minimum point of the axis-aligned bounding box"),
78 QStringList(tr("objectID")), QStringList(tr("id of an object")));
79
80 emit setSlotDescription("boundingBoxMax(int)",tr("get maximum point of the axis-aligned bounding box"),
81 QStringList(tr("objectID")), QStringList(tr("id of an object")));
82
83 emit setSlotDescription("boundingBoxSize(int)",tr("get the size of the axis-aligned bounding box"),
84 QStringList(tr("objectID")), QStringList(tr("id of an object")));
85
86
87 emit setSlotDescription("edgeLength(int,int)",tr("Get the length of an edge"),
88 QString(tr("ObjectId,EdgeHandle")).split(","),
89 QString(tr("id of the object, handle of an edge")).split(","));
90
91 emit setSlotDescription("faceArea(int,int)",tr("Get the area of a face"),
92 QString(tr("ObjectId,FaceHandle")).split(","),
93 QString(tr("id of the object, handle of a face")).split(","));
94
95 emit setSlotDescription("aspectRatio(int,int)",tr("Get the aspect ratio of a face"),
96 QString(tr("ObjectId,FaceHandle")).split(","),
97 QString(tr("id of the object, handle of a face")).split(","));
98
99 emit setSlotDescription("vertexValence(int,int)",tr("Get the valence of a vertex"),
100 QString(tr("ObjectId,VertexHandle")).split(","),
101 QString(tr("id of the object, handle of a vertex")).split(","));
102
103 emit setSlotDescription("minEdgeLength(int)",tr("Get the minimal edge length of an object"),
104 QStringList(tr("ObjectId")), QStringList(tr("id of the object")));
105
106 emit setSlotDescription("maxEdgeLength(int)",tr("Get the maximal edge length of an object"),
107 QStringList(tr("ObjectId")), QStringList(tr("id of the object")));
108
109 emit setSlotDescription("meanEdgeLength(int)",tr("Get the mean edge length of an object"),
110 QStringList(tr("ObjectId")), QStringList(tr("id of the object")));
111
112 }
113
114
115 //------------------------------------------------------------------------------
116
122 int InfoMeshObjectPlugin::vertexCount(int _id)
123 {
124
125 BaseObjectData* object;
126 if ( ! PluginFunctions::getObject(_id,object) )
127 return -1;
128
129 if ( object == 0){
130 emit log(LOGERR, tr("Unable to get object"));
131 return -1;
132 }
133
134 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
135 TriMesh* mesh = PluginFunctions::triMesh(object);
136
137 if ( mesh == 0 ) {
138 emit log(LOGERR, tr("Unable to get mesh"));
139 return -1;
140 }
141
142 return mesh->n_vertices();
143
144 } else {
145 PolyMesh* mesh = PluginFunctions::polyMesh(object);
146
147 if ( mesh == 0 ) {
148 emit log(LOGERR, tr("Unable to get mesh"));
149 return -1;
150 }
151
152 return mesh->n_vertices();
153 }
154 }
155
156
157 //------------------------------------------------------------------------------
158
164 int InfoMeshObjectPlugin::edgeCount(int _id)
165 {
166
167 BaseObjectData* object;
168 if ( ! PluginFunctions::getObject(_id,object) )
169 return -1;
170
171 if ( object == 0){
172 emit log(LOGERR, tr("Unable to get object"));
173 return -1;
174 }
175
176 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
177 TriMesh* mesh = PluginFunctions::triMesh(object);
178
179 if ( mesh == 0 ) {
180 emit log(LOGERR, tr("Unable to get mesh"));
181 return -1;
182 }
183
184 return mesh->n_edges();
185
186 } else {
187 PolyMesh* mesh = PluginFunctions::polyMesh(object);
188
189 if ( mesh == 0 ) {
190 emit log(LOGERR, tr("Unable to get mesh"));
191 return -1;
192 }
193
194 return mesh->n_edges();
195 }
196 }
197
198
199 //------------------------------------------------------------------------------
200
206 int InfoMeshObjectPlugin::faceCount(int _id)
207 {
208
209 BaseObjectData* object;
210 if ( ! PluginFunctions::getObject(_id,object) )
211 return -1;
212
213 if ( object == 0){
214 emit log(LOGERR, tr("Unable to get object"));
215 return -1;
216 }
217
218 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
219 TriMesh* mesh = PluginFunctions::triMesh(object);
220
221 if ( mesh == 0 ) {
222 emit log(LOGERR, tr("Unable to get mesh"));
223 return -1;
224 }
225
226 return mesh->n_faces();
227
228 } else {
229 PolyMesh* mesh = PluginFunctions::polyMesh(object);
230
231 if ( mesh == 0 ) {
232 emit log(LOGERR, tr("Unable to get mesh"));
233 return -1;
234 }
235
236 return mesh->n_faces();
237 }
238 }
239
240
241 //------------------------------------------------------------------------------
242
248 int InfoMeshObjectPlugin::boundaryCount(int _id)
249 {
250
251 BaseObjectData* object;
252 if ( ! PluginFunctions::getObject(_id,object) )
253 return -1;
254
255 if ( object == 0){
256 emit log(LOGERR, tr("Unable to get object"));
257 return -1;
258 }
259
260 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
261 TriMesh* mesh = PluginFunctions::triMesh(object);
262
263 if ( mesh == 0 ) {
264 emit log(LOGERR, tr("Unable to get mesh"));
265 return -1;
266 }
267
268 return MeshInfo::boundaryCount(mesh);
269
270 } else {
271 PolyMesh* mesh = PluginFunctions::polyMesh(object);
272
273 if ( mesh == 0 ) {
274 emit log(LOGERR, tr("Unable to get mesh"));
275 return -1;
276 }
277
278 return MeshInfo::boundaryCount(mesh);
279 }
280 }
281
282
283 //------------------------------------------------------------------------------
284
290 int InfoMeshObjectPlugin::componentCount(int _id)
291 {
292
293 BaseObjectData* object;
294 if ( ! PluginFunctions::getObject(_id,object) )
295 return -1;
296
297 if ( object == 0){
298 emit log(LOGERR, tr("Unable to get object"));
299 return -1;
300 }
301
302 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
303 TriMesh* mesh = PluginFunctions::triMesh(object);
304
305 if ( mesh == 0 ) {
306 emit log(LOGERR, tr("Unable to get mesh"));
307 return -1;
308 }
309
310 return MeshInfo::componentCount(mesh);
311
312 } else {
313 PolyMesh* mesh = PluginFunctions::polyMesh(object);
314
315 if ( mesh == 0 ) {
316 emit log(LOGERR, tr("Unable to get mesh"));
317 return -1;
318 }
319
320 return MeshInfo::componentCount(mesh);
321 }
322 }
323
324
325 //------------------------------------------------------------------------------
326
332 int InfoMeshObjectPlugin::genus(int _id)
333 {
334
335 BaseObjectData* object;
336 if ( ! PluginFunctions::getObject(_id,object) )
337 return -1;
338
339 if ( object == 0){
340 emit log(LOGERR, tr("Unable to get object"));
341 return -1;
342 }
343
344 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
345 TriMesh* mesh = PluginFunctions::triMesh(object);
346
347 if ( mesh == 0 ) {
348 emit log(LOGERR, tr("Unable to get mesh"));
349 return -1;
350 }
352 return (1 - (mesh->n_vertices() - mesh->n_edges() + mesh->n_faces() ) / 2);
353
354 } else {
355 PolyMesh* mesh = PluginFunctions::polyMesh(object);
356
357 if ( mesh == 0 ) {
358 emit log(LOGERR, tr("Unable to get mesh"));
359 return -1;
360 }
361
362 return (1 - (mesh->n_vertices() - mesh->n_edges() + mesh->n_faces() ) / 2);
363 }
364 }
365
366
367 //------------------------------------------------------------------------------
368
374 Vector InfoMeshObjectPlugin::cog(int _id)
375 {
376
377 BaseObjectData* object;
378 if ( ! PluginFunctions::getObject(_id,object) )
379 return Vector();
380
381 if ( object == 0){
382 emit log(LOGERR, tr("Unable to get object"));
383 return Vector();
384 }
385
386 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
387 TriMesh* mesh = PluginFunctions::triMesh(object);
388
389 if ( mesh == 0 ) {
390 emit log(LOGERR, tr("Unable to get mesh"));
391 return Vector();
392 }
393
394 return MeshInfo::cog(mesh);
395
396 } else {
397 PolyMesh* mesh = PluginFunctions::polyMesh(object);
398
399 if ( mesh == 0 ) {
400 emit log(LOGERR, tr("Unable to get mesh"));
401 return Vector();
402 }
403
404 return MeshInfo::cog(mesh);
405 }
406 }
407
408
409 //------------------------------------------------------------------------------
410
416 Vector InfoMeshObjectPlugin::boundingBoxMin(int _id)
417 {
418
419 BaseObjectData* object;
420 if ( ! PluginFunctions::getObject(_id,object) )
421 return Vector();
422
423 if ( object == 0){
424 emit log(LOGERR, tr("Unable to get object"));
425 return Vector();
426 }
427
428 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
429 TriMesh* mesh = PluginFunctions::triMesh(object);
430
431 if ( mesh == 0 ) {
432 emit log(LOGERR, tr("Unable to get mesh"));
433 return Vector();
434 }
435
436 ACG::Vec3d min;
437 ACG::Vec3d max;
438 MeshInfo::getBoundingBox(mesh, min, max);
439
440 return min;
441
442 } else {
443 PolyMesh* mesh = PluginFunctions::polyMesh(object);
444
445 if ( mesh == 0 ) {
446 emit log(LOGERR, tr("Unable to get mesh"));
447 return Vector();
448 }
449
450 ACG::Vec3d min;
451 ACG::Vec3d max;
452 MeshInfo::getBoundingBox(mesh, min, max);
453
454 return min;
455 }
456 }
457
458
459 //------------------------------------------------------------------------------
460
466 Vector InfoMeshObjectPlugin::boundingBoxMax(int _id)
467 {
468
469 BaseObjectData* object;
470 if ( ! PluginFunctions::getObject(_id,object) )
471 return Vector();
472
473 if ( object == 0){
474 emit log(LOGERR, tr("Unable to get object"));
475 return Vector();
476 }
477
478 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
479 TriMesh* mesh = PluginFunctions::triMesh(object);
480
481 if ( mesh == 0 ) {
482 emit log(LOGERR, tr("Unable to get mesh"));
483 return Vector();
484 }
485
486 ACG::Vec3d min;
487 ACG::Vec3d max;
488 MeshInfo::getBoundingBox(mesh, min, max);
489
490 return max;
491
492 } else {
493 PolyMesh* mesh = PluginFunctions::polyMesh(object);
494
495 if ( mesh == 0 ) {
496 emit log(LOGERR, tr("Unable to get mesh"));
497 return Vector();
498 }
499
500 ACG::Vec3d min;
501 ACG::Vec3d max;
502 MeshInfo::getBoundingBox(mesh, min, max);
503
504 return max;
505 }
506 }
507
508
509 //------------------------------------------------------------------------------
510
516 Vector InfoMeshObjectPlugin::boundingBoxSize(int _id)
517 {
518
519 BaseObjectData* object;
520 if ( ! PluginFunctions::getObject(_id,object) )
521 return Vector();
522
523 if ( object == 0){
524 emit log(LOGERR, tr("Unable to get object"));
525 return Vector();
526 }
527
528 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
529 TriMesh* mesh = PluginFunctions::triMesh(object);
530
531 if ( mesh == 0 ) {
532 emit log(LOGERR, tr("Unable to get mesh"));
533 return Vector();
534 }
535
536 ACG::Vec3d min;
537 ACG::Vec3d max;
538 MeshInfo::getBoundingBox(mesh, min, max);
539
540 return (max - min);
541
542 } else {
543 PolyMesh* mesh = PluginFunctions::polyMesh(object);
544
545 if ( mesh == 0 ) {
546 emit log(LOGERR, tr("Unable to get mesh"));
547 return Vector();
548 }
549
550 ACG::Vec3d min;
551 ACG::Vec3d max;
552 MeshInfo::getBoundingBox(mesh, min, max);
553
554 return (max - min);
555 }
556 }
557
558
559 //------------------------------------------------------------------------------
560
567 double InfoMeshObjectPlugin::edgeLength(int _id, int _edgeHandle)
568 {
569
570 BaseObjectData* object;
571 if ( ! PluginFunctions::getObject(_id,object) )
572 return -1.0;
573
574 if ( object == 0){
575 emit log(LOGERR, tr("Unable to get object"));
576 return -1.0;
577 }
578
579 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
580 TriMesh* mesh = PluginFunctions::triMesh(object);
581
582 if ( mesh == 0 ) {
583 emit log(LOGERR, tr("Unable to get mesh"));
584 return -1.0;
585 }
586
587 TriMesh::EdgeHandle eh( _edgeHandle );
588
589 if ( !eh.is_valid() ) {
590 emit log(LOGERR,tr("Unable to get edge handle"));
591 return -1.0;
592 }
593
594 TriMesh::HalfedgeHandle hh = mesh->halfedge_handle( eh, 0 );
595 TriMesh::Point p0 = mesh->point( mesh->from_vertex_handle(hh) );
596 TriMesh::Point p1 = mesh->point( mesh->to_vertex_handle(hh) );
597
598 return (p0 - p1).norm();
599
600 } else {
601 PolyMesh* mesh = PluginFunctions::polyMesh(object);
602
603 if ( mesh == 0 ) {
604 emit log(LOGERR, tr("Unable to get mesh"));
605 return -1.0;
606 }
607
608 PolyMesh::EdgeHandle eh( _edgeHandle );
609
610 if ( !eh.is_valid() ) {
611 emit log(LOGERR,tr("Unable to get edge handle"));
612 return -1.0;
613 }
614
615 PolyMesh::HalfedgeHandle hh = mesh->halfedge_handle( eh, 0 );
616 PolyMesh::Point p0 = mesh->point( mesh->from_vertex_handle(hh) );
617 PolyMesh::Point p1 = mesh->point( mesh->to_vertex_handle(hh) );
618
619 return (p0 - p1).norm();
620 }
621 }
622
623
624 //------------------------------------------------------------------------------
625
632 double InfoMeshObjectPlugin::faceArea(int _id, int _faceHandle)
633 {
634
635 BaseObjectData* object;
636 if ( ! PluginFunctions::getObject(_id,object) )
637 return -1.0;
638
639 if ( object == 0){
640 emit log(LOGERR, tr("Unable to get object"));
641 return -1.0;
642 }
643
644 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
645 TriMesh* mesh = PluginFunctions::triMesh(object);
646
647 if ( mesh == 0 ) {
648 emit log(LOGERR, tr("Unable to get mesh"));
649 return -1.0;
650 }
651
652 TriMesh::FaceHandle fh( _faceHandle );
653
654 if ( !fh.is_valid() ) {
655 emit log(LOGERR,tr("Unable to get face handle"));
656 return -1.0;
657 }
658
659 TriMesh::FaceVertexIter fv_it = mesh->fv_iter(fh);
660
661 TriMesh::Point v0 = mesh->point( *fv_it );
662 ++fv_it;
663 TriMesh::Point v1 = mesh->point( *fv_it );
664 ++fv_it;
665 TriMesh::Point v2 = mesh->point( *fv_it );
666
667 return ACG::Geometry::triangleArea( v0, v1, v2 );
668
669 } else {
670 PolyMesh* mesh = PluginFunctions::polyMesh(object);
671
672 if ( mesh == 0 ) {
673 emit log(LOGERR, tr("Unable to get mesh"));
674 return -1.0;
675 }
676
677 PolyMesh::FaceHandle fh( _faceHandle );
678
679 if ( !fh.is_valid() ) {
680 emit log(LOGERR,tr("Unable to get face handle"));
681 return -1.0;
682 }
683
684 PolyMesh::FaceVertexIter fv_it;
685
686 std::vector< PolyMesh::Point > vertices;
687
688 for (fv_it = mesh->fv_iter(fh); fv_it.is_valid(); ++fv_it)
689 vertices.push_back( mesh->point( *fv_it ) );
690
692 emit log(LOGERR,tr("Not implemented yet"));
693 return -1.0;
694 // return ACG::Geometry::polygonArea( vertices );
695 }
696 }
697
698
699 //------------------------------------------------------------------------------
700
707 double InfoMeshObjectPlugin::aspectRatio(int _id, int _faceHandle)
708 {
709
710 BaseObjectData* object;
711 if ( ! PluginFunctions::getObject(_id,object) )
712 return -1.0;
713
714 if ( object == 0){
715 emit log(LOGERR, tr("Unable to get object"));
716 return -1.0;
717 }
718
719 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
720 TriMesh* mesh = PluginFunctions::triMesh(object);
721
722 if ( mesh == 0 ) {
723 emit log(LOGERR, tr("Unable to get mesh"));
724 return -1.0;
725 }
726
727 TriMesh::FaceHandle fh( _faceHandle );
728
729 if ( !fh.is_valid() ) {
730 emit log(LOGERR,tr("Unable to get face handle"));
731 return -1.0;
732 }
733
734 TriMesh::FaceVertexIter fv_it = mesh->fv_iter(fh);
735
736 TriMesh::Point v0 = mesh->point( *fv_it );
737 ++fv_it;
738 TriMesh::Point v1 = mesh->point( *fv_it );
739 ++fv_it;
740 TriMesh::Point v2 = mesh->point( *fv_it );
741
742 return ACG::Geometry::aspectRatio( v0, v1, v2 );
743
744 } else {
745
746 emit log(LOGERR,tr("Aspect ratio can only be calculated for triangle meshes"));
747 return -1.0;
748 }
749 }
750
751
752 //------------------------------------------------------------------------------
753
760 int InfoMeshObjectPlugin::vertexValence (int _id, int _vertexHandle)
761 {
762
763 BaseObjectData* object;
764 if ( ! PluginFunctions::getObject(_id,object) )
765 return -1;
766
767 if ( object == 0){
768 emit log(LOGERR, tr("Unable to get object"));
769 return -1;
770 }
771
772 if ( object->dataType(DATA_TRIANGLE_MESH) ) {
773 TriMesh* mesh = PluginFunctions::triMesh(object);
774
775 if ( mesh == 0 ) {
776 emit log(LOGERR, tr("Unable to get mesh"));
777 return -1;
778 }
779
780 TriMesh::VertexHandle vh( _vertexHandle );
781
782 if ( !vh.is_valid() ) {
783 emit log(LOGERR,tr("Unable to get vertex handle"));
784 return -1;
785 }
786
787 //check valence
788 int valence = 0;
789 TriMesh::VertexVertexIter vv_it;
790
791 for (vv_it=mesh->vv_iter( vh ); vv_it.is_valid(); ++vv_it)
792 valence++;
793
794 return valence;
795
796 } else {
797 PolyMesh* mesh = PluginFunctions::polyMesh(object);
798
799 if ( mesh == 0 ) {
800 emit log(LOGERR, tr("Unable to get mesh"));
801 return -1;
802 }
803
804 PolyMesh::VertexHandle vh( _vertexHandle );
805
806 if ( !vh.is_valid() ) {
807 emit log(LOGERR,tr("Unable to get vertex handle"));
808 return -1;
809 }
810
811 //check valence
812 int valence = 0;
813 PolyMesh::VertexVertexIter vv_it;
814
815 for (vv_it=mesh->vv_iter( vh ); vv_it.is_valid(); ++vv_it)
816 valence++;
817
818 return valence;
819 }
820 }
821
822 //------------------------------------------------------------------------------
823
829 double InfoMeshObjectPlugin::minEdgeLength(int _id)
830 {
831 double min, max, mean;
832
833 if (getEdgeLengths (_id, min, max, mean))
834 return min;
835 else
836 return -1;
837 }
838
839 //------------------------------------------------------------------------------
840
846 double InfoMeshObjectPlugin::maxEdgeLength(int _id)
847 {
848 double min, max, mean;
849
850 if (getEdgeLengths (_id, min, max, mean))
851 return max;
852 else
853 return -1;
854 }
855
856 //------------------------------------------------------------------------------
857
863 double InfoMeshObjectPlugin::meanEdgeLength(int _id)
864 {
865 double min, max, mean;
866
867 if (getEdgeLengths (_id, min, max, mean))
868 return mean;
869 else
870 return -1;
871 }
LOGERR
Definition: LoggingInterface.hh:96
OpenMesh::PolyMeshT::VertexVertexIter
Kernel::VertexVertexIter VertexVertexIter
Circulator.
Definition: PolyMeshT.hh:162
InfoMeshObjectPlugin::meanEdgeLength
double meanEdgeLength(int _id)
get the mean edge length
Definition: MeshObjectInfoScripting.cc:863
DATA_TRIANGLE_MESH
#define DATA_TRIANGLE_MESH
Definition: TriangleMesh.hh:60
InfoMeshObjectPlugin::vertexCount
int vertexCount(int _id)
get total number of vertices for a given object
Definition: MeshObjectInfoScripting.cc:122
PluginFunctions::polyMesh
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
Definition: PluginFunctionsPolyMesh.cc:128
OpenMesh::PolyMeshT::FaceVertexIter
Kernel::FaceVertexIter FaceVertexIter
Circulator.
Definition: PolyMeshT.hh:167
InfoMeshObjectPlugin::getEdgeLengths
void getEdgeLengths(MeshT *_mesh, double &min, double &max, double &mean)
Get edge lengths.
Definition: MeshObjectInfoPlugin.cc:796
OpenMesh::PolyMeshT::Point
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
PluginFunctions::getObject
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
Definition: PluginFunctions.cc:296
OpenMesh::TriMesh_ArrayKernelT
Definition: PolyMesh_ArrayKernelT.hh:73
InfoMeshObjectPlugin::cog
Vector cog(int _id)
get the center of gravity
Definition: MeshObjectInfoScripting.cc:374
OpenMesh::VectorT
Definition: Vector11T.hh:83
PluginFunctions::triMesh
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
Definition: PluginFunctionsTriangleMesh.cc:134
OpenMesh::PolyMesh_ArrayKernelT
Definition: PolyMesh_ArrayKernelT.hh:94
ACG::Geometry::aspectRatio
Scalar aspectRatio(const VectorT< Scalar, N > &_v0, const VectorT< Scalar, N > &_v1, const VectorT< Scalar, N > &_v2)
return aspect ratio (length/height) of triangle
Definition: Algorithms.cc:1256
InfoMeshObjectPlugin::aspectRatio
double aspectRatio(int _id, int _faceHandle)
get the aspect ratio of a face
Definition: MeshObjectInfoScripting.cc:707
BaseObject::dataType
bool dataType(DataType _type) const
Definition: BaseObject.cc:221
Vector
ACG::Vec3d Vector
Standard Type for 3d Vector used for scripting.
Definition: DataTypes.hh:174
InfoMeshObjectPlugin::maxEdgeLength
double maxEdgeLength(int _id)
get the maximal edge length
Definition: MeshObjectInfoScripting.cc:846
InfoMeshObjectPlugin::vertexValence
int vertexValence(int _id, int _vertexHandle)
get vertex valence
Definition: MeshObjectInfoScripting.cc:760
InfoMeshObjectPlugin::edgeLength
double edgeLength(int _id, int _edgeHandle)
get the length of an edge
Definition: MeshObjectInfoScripting.cc:567
InfoMeshObjectPlugin::boundaryCount
int boundaryCount(int _id)
get the number of boundaries for a given object
Definition: MeshObjectInfoScripting.cc:248
BaseObjectData
Definition: BaseObjectData.hh:102
InfoMeshObjectPlugin::faceArea
double faceArea(int _id, int _faceHandle)
get the area of a face
Definition: MeshObjectInfoScripting.cc:632
InfoMeshObjectPlugin::edgeCount
int edgeCount(int _id)
get total number of edges for a given object
Definition: MeshObjectInfoScripting.cc:164
InfoMeshObjectPlugin::boundingBoxMax
Vector boundingBoxMax(int _id)
get maximum bounding box point
Definition: MeshObjectInfoScripting.cc:466
InfoMeshObjectPlugin::faceCount
int faceCount(int _id)
get total number of faces for a given object
Definition: MeshObjectInfoScripting.cc:206
InfoMeshObjectPlugin::setDescriptions
void setDescriptions()
set scripting slot descriptions
Definition: MeshObjectInfoScripting.cc:54
InfoMeshObjectPlugin::boundingBoxSize
Vector boundingBoxSize(int _id)
get the size of the bounding box
Definition: MeshObjectInfoScripting.cc:516
InfoMeshObjectPlugin::boundingBoxMin
Vector boundingBoxMin(int _id)
get minumum bounding box point
Definition: MeshObjectInfoScripting.cc:416
InfoMeshObjectPlugin::componentCount
int componentCount(int _id)
get the number of components for a given object
Definition: MeshObjectInfoScripting.cc:290
ACG::Geometry::triangleArea
Vec::value_type triangleArea(const Vec &_v0, const Vec &_v1, const Vec &_v2)
return area of triangle (_v0, _v1, _v2)
Definition: Algorithms.hh:595
InfoMeshObjectPlugin::minEdgeLength
double minEdgeLength(int _id)
get the minimal edge length
Definition: MeshObjectInfoScripting.cc:829
OpenMesh::PolyMeshT::VertexHandle
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
InfoMeshObjectPlugin::genus
int genus(int _id)
get the genus of the given object
Definition: MeshObjectInfoScripting.cc:332