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 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 #include "MeshObjectInfoPlugin.hh"
51 
52 #include <MeshTools/MeshInfoT.hh>
53 
54 
55 //------------------------------------------------------------------------------
56 
61 
62  emit setSlotDescription("vertexCount(int)",tr("get total number of vertices for a given object"),
63  QStringList(tr("objectID")), QStringList(tr("id of an object")));
64 
65  emit setSlotDescription("edgeCount(int)",tr("get total number of edges for a given object"),
66  QStringList(tr("objectID")), QStringList(tr("id of an object")));
67 
68  emit setSlotDescription("faceCount(int)",tr("get total number of faces for a given object"),
69  QStringList(tr("objectID")), QStringList(tr("id of an object")));
70 
71  emit setSlotDescription("boundaryCount(int)",tr("get number of boundaries for a given object"),
72  QStringList(tr("objectID")), QStringList(tr("id of an object")));
73 
74  emit setSlotDescription("componentCount(int)",tr("get number of components for a given object"),
75  QStringList(tr("objectID")), QStringList(tr("id of an object")));
76 
77  emit setSlotDescription("genus(int)",tr("get the genus of a given object"),
78  QStringList(tr("objectID")), QStringList(tr("id of an object")));
79 
80  emit setSlotDescription("cog(int)",tr("get the center of gravity for a given object"),
81  QStringList(tr("objectID")), QStringList(tr("id of an object")));
82 
83  emit setSlotDescription("boundingBoxMin(int)",tr("get minimum point of the axis-aligned bounding box"),
84  QStringList(tr("objectID")), QStringList(tr("id of an object")));
85 
86  emit setSlotDescription("boundingBoxMax(int)",tr("get maximum point of the axis-aligned bounding box"),
87  QStringList(tr("objectID")), QStringList(tr("id of an object")));
88 
89  emit setSlotDescription("boundingBoxSize(int)",tr("get the size of the axis-aligned bounding box"),
90  QStringList(tr("objectID")), QStringList(tr("id of an object")));
91 
92 
93  emit setSlotDescription("edgeLength(int,int)",tr("Get the length of an edge"),
94  QString(tr("ObjectId,EdgeHandle")).split(","),
95  QString(tr("id of the object, handle of an edge")).split(","));
96 
97  emit setSlotDescription("faceArea(int,int)",tr("Get the area of a face"),
98  QString(tr("ObjectId,FaceHandle")).split(","),
99  QString(tr("id of the object, handle of a face")).split(","));
100 
101  emit setSlotDescription("aspectRatio(int,int)",tr("Get the aspect ratio of a face"),
102  QString(tr("ObjectId,FaceHandle")).split(","),
103  QString(tr("id of the object, handle of a face")).split(","));
104 
105  emit setSlotDescription("vertexValence(int,int)",tr("Get the valence of a vertex"),
106  QString(tr("ObjectId,VertexHandle")).split(","),
107  QString(tr("id of the object, handle of a vertex")).split(","));
108 
109  emit setSlotDescription("minEdgeLength(int)",tr("Get the minimal edge length of an object"),
110  QStringList(tr("ObjectId")), QStringList(tr("id of the object")));
111 
112  emit setSlotDescription("maxEdgeLength(int)",tr("Get the maximal edge length of an object"),
113  QStringList(tr("ObjectId")), QStringList(tr("id of the object")));
114 
115  emit setSlotDescription("meanEdgeLength(int)",tr("Get the mean edge length of an object"),
116  QStringList(tr("ObjectId")), QStringList(tr("id of the object")));
117 
118 }
119 
120 
121 //------------------------------------------------------------------------------
122 
129 {
130 
131  BaseObjectData* object;
132  if ( ! PluginFunctions::getObject(_id,object) )
133  return -1;
134 
135  if ( object == 0){
136  emit log(LOGERR, tr("Unable to get object"));
137  return -1;
138  }
139 
140  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
141  TriMesh* mesh = PluginFunctions::triMesh(object);
142 
143  if ( mesh == 0 ) {
144  emit log(LOGERR, tr("Unable to get mesh"));
145  return -1;
146  }
147 
148  return mesh->n_vertices();
149 
150  } else {
151  PolyMesh* mesh = PluginFunctions::polyMesh(object);
152 
153  if ( mesh == 0 ) {
154  emit log(LOGERR, tr("Unable to get mesh"));
155  return -1;
156  }
157 
158  return mesh->n_vertices();
159  }
160 }
161 
162 
163 //------------------------------------------------------------------------------
164 
171 {
172 
173  BaseObjectData* object;
174  if ( ! PluginFunctions::getObject(_id,object) )
175  return -1;
176 
177  if ( object == 0){
178  emit log(LOGERR, tr("Unable to get object"));
179  return -1;
180  }
181 
182  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
183  TriMesh* mesh = PluginFunctions::triMesh(object);
184 
185  if ( mesh == 0 ) {
186  emit log(LOGERR, tr("Unable to get mesh"));
187  return -1;
188  }
189 
190  return mesh->n_edges();
191 
192  } else {
193  PolyMesh* mesh = PluginFunctions::polyMesh(object);
194 
195  if ( mesh == 0 ) {
196  emit log(LOGERR, tr("Unable to get mesh"));
197  return -1;
198  }
199 
200  return mesh->n_edges();
201  }
202 }
203 
204 
205 //------------------------------------------------------------------------------
206 
213 {
214 
215  BaseObjectData* object;
216  if ( ! PluginFunctions::getObject(_id,object) )
217  return -1;
218 
219  if ( object == 0){
220  emit log(LOGERR, tr("Unable to get object"));
221  return -1;
222  }
223 
224  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
225  TriMesh* mesh = PluginFunctions::triMesh(object);
226 
227  if ( mesh == 0 ) {
228  emit log(LOGERR, tr("Unable to get mesh"));
229  return -1;
230  }
231 
232  return mesh->n_faces();
233 
234  } else {
235  PolyMesh* mesh = PluginFunctions::polyMesh(object);
236 
237  if ( mesh == 0 ) {
238  emit log(LOGERR, tr("Unable to get mesh"));
239  return -1;
240  }
241 
242  return mesh->n_faces();
243  }
244 }
245 
246 
247 //------------------------------------------------------------------------------
248 
255 {
256 
257  BaseObjectData* object;
258  if ( ! PluginFunctions::getObject(_id,object) )
259  return -1;
260 
261  if ( object == 0){
262  emit log(LOGERR, tr("Unable to get object"));
263  return -1;
264  }
265 
266  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
267  TriMesh* mesh = PluginFunctions::triMesh(object);
268 
269  if ( mesh == 0 ) {
270  emit log(LOGERR, tr("Unable to get mesh"));
271  return -1;
272  }
273 
274  return MeshInfo::boundaryCount(mesh);
275 
276  } else {
277  PolyMesh* mesh = PluginFunctions::polyMesh(object);
278 
279  if ( mesh == 0 ) {
280  emit log(LOGERR, tr("Unable to get mesh"));
281  return -1;
282  }
283 
284  return MeshInfo::boundaryCount(mesh);
285  }
286 }
287 
288 
289 //------------------------------------------------------------------------------
290 
297 {
298 
299  BaseObjectData* object;
300  if ( ! PluginFunctions::getObject(_id,object) )
301  return -1;
302 
303  if ( object == 0){
304  emit log(LOGERR, tr("Unable to get object"));
305  return -1;
306  }
307 
308  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
309  TriMesh* mesh = PluginFunctions::triMesh(object);
310 
311  if ( mesh == 0 ) {
312  emit log(LOGERR, tr("Unable to get mesh"));
313  return -1;
314  }
315 
316  return MeshInfo::componentCount(mesh);
317 
318  } else {
319  PolyMesh* mesh = PluginFunctions::polyMesh(object);
320 
321  if ( mesh == 0 ) {
322  emit log(LOGERR, tr("Unable to get mesh"));
323  return -1;
324  }
325 
326  return MeshInfo::componentCount(mesh);
327  }
328 }
329 
330 
331 //------------------------------------------------------------------------------
332 
339 {
340 
341  BaseObjectData* object;
342  if ( ! PluginFunctions::getObject(_id,object) )
343  return -1;
344 
345  if ( object == 0){
346  emit log(LOGERR, tr("Unable to get object"));
347  return -1;
348  }
349 
350  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
351  TriMesh* mesh = PluginFunctions::triMesh(object);
352 
353  if ( mesh == 0 ) {
354  emit log(LOGERR, tr("Unable to get mesh"));
355  return -1;
356  }
358  return (1 - (mesh->n_vertices() - mesh->n_edges() + mesh->n_faces() ) / 2);
359 
360  } else {
361  PolyMesh* mesh = PluginFunctions::polyMesh(object);
362 
363  if ( mesh == 0 ) {
364  emit log(LOGERR, tr("Unable to get mesh"));
365  return -1;
366  }
367 
368  return (1 - (mesh->n_vertices() - mesh->n_edges() + mesh->n_faces() ) / 2);
369  }
370 }
371 
372 
373 //------------------------------------------------------------------------------
374 
381 {
382 
383  BaseObjectData* object;
384  if ( ! PluginFunctions::getObject(_id,object) )
385  return Vector();
386 
387  if ( object == 0){
388  emit log(LOGERR, tr("Unable to get object"));
389  return Vector();
390  }
391 
392  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
393  TriMesh* mesh = PluginFunctions::triMesh(object);
394 
395  if ( mesh == 0 ) {
396  emit log(LOGERR, tr("Unable to get mesh"));
397  return Vector();
398  }
399 
400  return MeshInfo::cog(mesh);
401 
402  } else {
403  PolyMesh* mesh = PluginFunctions::polyMesh(object);
404 
405  if ( mesh == 0 ) {
406  emit log(LOGERR, tr("Unable to get mesh"));
407  return Vector();
408  }
409 
410  return MeshInfo::cog(mesh);
411  }
412 }
413 
414 
415 //------------------------------------------------------------------------------
416 
423 {
424 
425  BaseObjectData* object;
426  if ( ! PluginFunctions::getObject(_id,object) )
427  return Vector();
428 
429  if ( object == 0){
430  emit log(LOGERR, tr("Unable to get object"));
431  return Vector();
432  }
433 
434  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
435  TriMesh* mesh = PluginFunctions::triMesh(object);
436 
437  if ( mesh == 0 ) {
438  emit log(LOGERR, tr("Unable to get mesh"));
439  return Vector();
440  }
441 
442  ACG::Vec3d min;
443  ACG::Vec3d max;
444  MeshInfo::getBoundingBox(mesh, min, max);
445 
446  return min;
447 
448  } else {
449  PolyMesh* mesh = PluginFunctions::polyMesh(object);
450 
451  if ( mesh == 0 ) {
452  emit log(LOGERR, tr("Unable to get mesh"));
453  return Vector();
454  }
455 
456  ACG::Vec3d min;
457  ACG::Vec3d max;
458  MeshInfo::getBoundingBox(mesh, min, max);
459 
460  return min;
461  }
462 }
463 
464 
465 //------------------------------------------------------------------------------
466 
473 {
474 
475  BaseObjectData* object;
476  if ( ! PluginFunctions::getObject(_id,object) )
477  return Vector();
478 
479  if ( object == 0){
480  emit log(LOGERR, tr("Unable to get object"));
481  return Vector();
482  }
483 
484  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
485  TriMesh* mesh = PluginFunctions::triMesh(object);
486 
487  if ( mesh == 0 ) {
488  emit log(LOGERR, tr("Unable to get mesh"));
489  return Vector();
490  }
491 
492  ACG::Vec3d min;
493  ACG::Vec3d max;
494  MeshInfo::getBoundingBox(mesh, min, max);
495 
496  return max;
497 
498  } else {
499  PolyMesh* mesh = PluginFunctions::polyMesh(object);
500 
501  if ( mesh == 0 ) {
502  emit log(LOGERR, tr("Unable to get mesh"));
503  return Vector();
504  }
505 
506  ACG::Vec3d min;
507  ACG::Vec3d max;
508  MeshInfo::getBoundingBox(mesh, min, max);
509 
510  return max;
511  }
512 }
513 
514 
515 //------------------------------------------------------------------------------
516 
523 {
524 
525  BaseObjectData* object;
526  if ( ! PluginFunctions::getObject(_id,object) )
527  return Vector();
528 
529  if ( object == 0){
530  emit log(LOGERR, tr("Unable to get object"));
531  return Vector();
532  }
533 
534  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
535  TriMesh* mesh = PluginFunctions::triMesh(object);
536 
537  if ( mesh == 0 ) {
538  emit log(LOGERR, tr("Unable to get mesh"));
539  return Vector();
540  }
541 
542  ACG::Vec3d min;
543  ACG::Vec3d max;
544  MeshInfo::getBoundingBox(mesh, min, max);
545 
546  return (max - min);
547 
548  } else {
549  PolyMesh* mesh = PluginFunctions::polyMesh(object);
550 
551  if ( mesh == 0 ) {
552  emit log(LOGERR, tr("Unable to get mesh"));
553  return Vector();
554  }
555 
556  ACG::Vec3d min;
557  ACG::Vec3d max;
558  MeshInfo::getBoundingBox(mesh, min, max);
559 
560  return (max - min);
561  }
562 }
563 
564 
565 //------------------------------------------------------------------------------
566 
573 double InfoMeshObjectPlugin::edgeLength(int _id, int _edgeHandle)
574 {
575 
576  BaseObjectData* object;
577  if ( ! PluginFunctions::getObject(_id,object) )
578  return -1.0;
579 
580  if ( object == 0){
581  emit log(LOGERR, tr("Unable to get object"));
582  return -1.0;
583  }
584 
585  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
586  TriMesh* mesh = PluginFunctions::triMesh(object);
587 
588  if ( mesh == 0 ) {
589  emit log(LOGERR, tr("Unable to get mesh"));
590  return -1.0;
591  }
592 
593  TriMesh::EdgeHandle eh( _edgeHandle );
594 
595  if ( !eh.is_valid() ) {
596  emit log(LOGERR,tr("Unable to get edge handle"));
597  return -1.0;
598  }
599 
600  TriMesh::HalfedgeHandle hh = mesh->halfedge_handle( eh, 0 );
601  TriMesh::Point p0 = mesh->point( mesh->from_vertex_handle(hh) );
602  TriMesh::Point p1 = mesh->point( mesh->to_vertex_handle(hh) );
603 
604  return (p0 - p1).norm();
605 
606  } else {
607  PolyMesh* mesh = PluginFunctions::polyMesh(object);
608 
609  if ( mesh == 0 ) {
610  emit log(LOGERR, tr("Unable to get mesh"));
611  return -1.0;
612  }
613 
614  PolyMesh::EdgeHandle eh( _edgeHandle );
615 
616  if ( !eh.is_valid() ) {
617  emit log(LOGERR,tr("Unable to get edge handle"));
618  return -1.0;
619  }
620 
621  PolyMesh::HalfedgeHandle hh = mesh->halfedge_handle( eh, 0 );
622  PolyMesh::Point p0 = mesh->point( mesh->from_vertex_handle(hh) );
623  PolyMesh::Point p1 = mesh->point( mesh->to_vertex_handle(hh) );
624 
625  return (p0 - p1).norm();
626  }
627 }
628 
629 
630 //------------------------------------------------------------------------------
631 
638 double InfoMeshObjectPlugin::faceArea(int _id, int _faceHandle)
639 {
640 
641  BaseObjectData* object;
642  if ( ! PluginFunctions::getObject(_id,object) )
643  return -1.0;
644 
645  if ( object == 0){
646  emit log(LOGERR, tr("Unable to get object"));
647  return -1.0;
648  }
649 
650  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
651  TriMesh* mesh = PluginFunctions::triMesh(object);
652 
653  if ( mesh == 0 ) {
654  emit log(LOGERR, tr("Unable to get mesh"));
655  return -1.0;
656  }
657 
658  TriMesh::FaceHandle fh( _faceHandle );
659 
660  if ( !fh.is_valid() ) {
661  emit log(LOGERR,tr("Unable to get face handle"));
662  return -1.0;
663  }
664 
665  TriMesh::FaceVertexIter fv_it = mesh->fv_iter(fh);
666 
667  TriMesh::Point v0 = mesh->point( *fv_it );
668  ++fv_it;
669  TriMesh::Point v1 = mesh->point( *fv_it );
670  ++fv_it;
671  TriMesh::Point v2 = mesh->point( *fv_it );
672 
673  return ACG::Geometry::triangleArea( v0, v1, v2 );
674 
675  } else {
676  PolyMesh* mesh = PluginFunctions::polyMesh(object);
677 
678  if ( mesh == 0 ) {
679  emit log(LOGERR, tr("Unable to get mesh"));
680  return -1.0;
681  }
682 
683  PolyMesh::FaceHandle fh( _faceHandle );
684 
685  if ( !fh.is_valid() ) {
686  emit log(LOGERR,tr("Unable to get face handle"));
687  return -1.0;
688  }
689 
691 
692  std::vector< PolyMesh::Point > vertices;
693 
694  for (fv_it = mesh->fv_iter(fh); fv_it.is_valid(); ++fv_it)
695  vertices.push_back( mesh->point( *fv_it ) );
696 
698  emit log(LOGERR,tr("Not implemented yet"));
699  return -1.0;
700 // return ACG::Geometry::polygonArea( vertices );
701  }
702 }
703 
704 
705 //------------------------------------------------------------------------------
706 
713 double InfoMeshObjectPlugin::aspectRatio(int _id, int _faceHandle)
714 {
715 
716  BaseObjectData* object;
717  if ( ! PluginFunctions::getObject(_id,object) )
718  return -1.0;
719 
720  if ( object == 0){
721  emit log(LOGERR, tr("Unable to get object"));
722  return -1.0;
723  }
724 
725  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
726  TriMesh* mesh = PluginFunctions::triMesh(object);
727 
728  if ( mesh == 0 ) {
729  emit log(LOGERR, tr("Unable to get mesh"));
730  return -1.0;
731  }
732 
733  TriMesh::FaceHandle fh( _faceHandle );
734 
735  if ( !fh.is_valid() ) {
736  emit log(LOGERR,tr("Unable to get face handle"));
737  return -1.0;
738  }
739 
740  TriMesh::FaceVertexIter fv_it = mesh->fv_iter(fh);
741 
742  TriMesh::Point v0 = mesh->point( *fv_it );
743  ++fv_it;
744  TriMesh::Point v1 = mesh->point( *fv_it );
745  ++fv_it;
746  TriMesh::Point v2 = mesh->point( *fv_it );
747 
748  return ACG::Geometry::aspectRatio( v0, v1, v2 );
749 
750  } else {
751 
752  emit log(LOGERR,tr("Aspect ratio can only be calculated for triangle meshes"));
753  return -1.0;
754  }
755 }
756 
757 
758 //------------------------------------------------------------------------------
759 
766 int InfoMeshObjectPlugin::vertexValence (int _id, int _vertexHandle)
767 {
768 
769  BaseObjectData* object;
770  if ( ! PluginFunctions::getObject(_id,object) )
771  return -1;
772 
773  if ( object == 0){
774  emit log(LOGERR, tr("Unable to get object"));
775  return -1;
776  }
777 
778  if ( object->dataType(DATA_TRIANGLE_MESH) ) {
779  TriMesh* mesh = PluginFunctions::triMesh(object);
780 
781  if ( mesh == 0 ) {
782  emit log(LOGERR, tr("Unable to get mesh"));
783  return -1;
784  }
785 
786  TriMesh::VertexHandle vh( _vertexHandle );
787 
788  if ( !vh.is_valid() ) {
789  emit log(LOGERR,tr("Unable to get vertex handle"));
790  return -1;
791  }
792 
793  //check valence
794  int valence = 0;
796 
797  for (vv_it=mesh->vv_iter( vh ); vv_it.is_valid(); ++vv_it)
798  valence++;
799 
800  return valence;
801 
802  } else {
803  PolyMesh* mesh = PluginFunctions::polyMesh(object);
804 
805  if ( mesh == 0 ) {
806  emit log(LOGERR, tr("Unable to get mesh"));
807  return -1;
808  }
809 
810  PolyMesh::VertexHandle vh( _vertexHandle );
811 
812  if ( !vh.is_valid() ) {
813  emit log(LOGERR,tr("Unable to get vertex handle"));
814  return -1;
815  }
816 
817  //check valence
818  int valence = 0;
820 
821  for (vv_it=mesh->vv_iter( vh ); vv_it.is_valid(); ++vv_it)
822  valence++;
823 
824  return valence;
825  }
826 }
827 
828 //------------------------------------------------------------------------------
829 
836 {
837  double min, max, mean;
838 
839  if (getEdgeLengths (_id, min, max, mean))
840  return min;
841  else
842  return -1;
843 }
844 
845 //------------------------------------------------------------------------------
846 
853 {
854  double min, max, mean;
855 
856  if (getEdgeLengths (_id, min, max, mean))
857  return max;
858  else
859  return -1;
860 }
861 
862 //------------------------------------------------------------------------------
863 
870 {
871  double min, max, mean;
872 
873  if (getEdgeLengths (_id, min, max, mean))
874  return mean;
875  else
876  return -1;
877 }
double edgeLength(int _id, int _edgeHandle)
get the length of an edge
double minEdgeLength(int _id)
get the minimal edge length
int faceCount(int _id)
get total number of faces for a given object
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:1266
bool getObject(int _identifier, BSplineCurveObject *&_object)
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
bool dataType(DataType _type) const
Definition: BaseObject.cc:232
double maxEdgeLength(int _id)
get the maximal edge length
int boundaryCount(int _id)
get the number of boundaries for a given object
Vector boundingBoxMax(int _id)
get maximum bounding box point
int componentCount(int _id)
get the number of components for a given object
void setDescriptions()
set scripting slot descriptions
Vector boundingBoxMin(int _id)
get minumum bounding box point
int vertexValence(int _id, int _vertexHandle)
get vertex valence
double faceArea(int _id, int _faceHandle)
get the area of a face
Kernel::FaceVertexIter FaceVertexIter
Circulator.
Definition: PolyMeshT.hh:170
double meanEdgeLength(int _id)
get the mean edge length
int vertexCount(int _id)
get total number of vertices for a given object
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:139
double aspectRatio(int _id, int _faceHandle)
get the aspect ratio of a face
ACG::Vec3d Vector
Standard Type for 3d Vector used for scripting.
Definition: DataTypes.hh:187
Kernel::VertexVertexIter VertexVertexIter
Circulator.
Definition: PolyMeshT.hh:165
int edgeCount(int _id)
get total number of edges for a given object
void getEdgeLengths(MeshT *_mesh, double &min, double &max, double &mean)
Get edge lengths.
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:115
Vec::value_type triangleArea(const Vec &_v0, const Vec &_v1, const Vec &_v2)
return area of triangle (_v0, _v1, _v2)
Definition: Algorithms.hh:602
Vector cog(int _id)
get the center of gravity
int genus(int _id)
get the genus of the given object
#define DATA_TRIANGLE_MESH
Definition: TriangleMesh.hh:66
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
Vector boundingBoxSize(int _id)
get the size of the bounding box