41 if ((iA ==
nullptr) && (t == 1.0f)) {
45 else if ((iB ==
nullptr) && (t == 0.0f)) {
61 if ((iA->
A() == iB->
A()) && (iA->
B() == iB->
B()) && (iA->
A() !=
nullptr) &&
62 (iA->
B() !=
nullptr) && (iB->
A() !=
nullptr) && (iB->
B() !=
nullptr))
66 _t2d = t1 + t2 * t3 - t1 * t3;
68 else if ((iA->
B() ==
nullptr) && (iB->
B() ==
nullptr)) {
73 else if ((iA->
t2d() == 0) && (iB->
t2d() == 0)) {
78 else if (iA->
A() == iB->
A()) {
85 else if (iB->
t2d() == 0) {
91 else if (iA->
B() == iB->
B()) {
98 else if (iB->
t2d() == 1) {
104 else if (iA->
B() == iB->
A()) {
106 if ((iA->
t2d() != 1.0f) && (iB->
t2d() == 0.0f)) {
109 _t2d = t1 + t3 - t1 * t3;
112 else if ((iA->
t2d() == 1.0f) && (iB->
t2d() != 0.0f)) {
125 else if (iA->
A() !=
nullptr && iB->
A() !=
nullptr &&
130 else if (iA->
B() !=
nullptr && iB->
B() !=
nullptr &&
135 else if (iA->
B() !=
nullptr && iB->
A() !=
nullptr &&
154 cerr <<
"Fatal error in CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3)"
199 cerr <<
"Warning: CurvePoint::getFEdge() failed to cast the given 0D element to CurvePoint."
203 if (((
__A == iVertexB->
__A) && (
__B == iVertexB->
__B)) ||
206 return __A->getFEdge(*
__B);
208 if (
__B ==
nullptr) {
209 if (iVertexB->
__B ==
nullptr) {
210 return __A->getFEdge(*(iVertexB->
__A));
212 if (iVertexB->
__A ==
__A) {
213 return __A->getFEdge(*(iVertexB->
__B));
215 if (iVertexB->
__B ==
__A) {
216 return __A->getFEdge(*(iVertexB->
__A));
219 if (iVertexB->
__B ==
nullptr) {
220 if (iVertexB->
__A ==
__A) {
221 return __B->getFEdge(*(iVertexB->
__A));
223 if (iVertexB->
__A ==
__B) {
224 return __A->getFEdge(*(iVertexB->
__A));
227 if (
__B == iVertexB->
__A) {
228 if ((
_t2d != 1) && (iVertexB->
_t2d == 0)) {
229 return __A->getFEdge(*
__B);
231 if ((
_t2d == 1) && (iVertexB->
_t2d != 0)) {
235 if (
__B == iVertexB->
__B) {
236 if ((
_t2d != 1) && (iVertexB->
_t2d == 1)) {
237 return __A->getFEdge(*
__B);
239 if ((
_t2d == 1) && (iVertexB->
_t2d != 1)) {
243 if (
__A == iVertexB->
__A) {
244 if ((
_t2d == 0) && (iVertexB->
_t2d != 0)) {
247 if ((
_t2d != 0) && (iVertexB->
_t2d == 0)) {
248 return __A->getFEdge(*
__B);
251 if (
__A == iVertexB->
__B) {
252 if ((
_t2d == 0) && (iVertexB->
_t2d != 1)) {
255 if ((
_t2d != 0) && (iVertexB->
_t2d == 1)) {
256 return __A->getFEdge(*
__B);
261 printf(
"__A 0x%p p (%f, %f)\n",
__A,
__A->getPoint2D().x(),
__A->getPoint2D().y());
262 printf(
"__B 0x%p p (%f, %f)\n",
__B,
__B->getPoint2D().x(),
__B->getPoint2D().y());
263 printf(
"iVertexB->A() 0x%p p (%f, %f)\n",
267 printf(
"iVertexB->B() 0x%p p (%f, %f)\n",
272 printf(
"iVertexB->t2d() %f p (%f, %f)\n",
278 cerr <<
"Warning: CurvePoint::getFEdge() failed." << endl;
285 if (
__B ==
nullptr) {
286 return __A->normal();
288 if (
__A ==
nullptr) {
289 return __B->normal();
301 return ((1 - t3d) * Na + t3d * Nb);
305Material CurvePoint::material()
const
308 return __B->material();
310 return __A->material();
313Id CurvePoint::shape_id()
const
316 return __B->shape_id();
318 return __A->shape_id();
324 if (
__A ==
nullptr) {
331float CurvePoint::shape_importance()
const
339const uint CurvePoint::qi()
const
347 return __A->getFEdge(*__B)->qi();
353 if (
__A ==
nullptr) {
354 return __B->occluders_begin();
356 if (
__B ==
nullptr) {
357 return __A->occluders_begin();
359 return __A->getFEdge(*__B)->occluders_begin();
364 if (
__A ==
nullptr) {
365 return __B->occluders_end();
367 if (
__B ==
nullptr) {
368 return __A->occluders_end();
370 return __A->getFEdge(*__B)->occluders_end();
375 if (
__A ==
nullptr) {
376 return __B->occluders_empty();
378 if (
__B ==
nullptr) {
379 return __A->occluders_empty();
381 return __A->getFEdge(*__B)->occluders_empty();
386 if (
__A ==
nullptr) {
387 return __B->occluders_size();
389 if (
__B ==
nullptr) {
390 return __A->occluders_size();
392 return __A->getFEdge(*__B)->occluders_size();
397 if (
__A ==
nullptr) {
398 return __B->occluded_shape();
400 if (
__B ==
nullptr) {
401 return __A->occluded_shape();
403 return __A->getFEdge(*__B)->occluded_shape();
408 if (
__A ==
nullptr) {
409 return __B->occludee();
411 if (
__B ==
nullptr) {
412 return __A->occludee();
414 return __A->getFEdge(*__B)->occludee();
419 if (
__A ==
nullptr) {
420 return __B->occludee_empty();
422 if (
__B ==
nullptr) {
423 return __A->occludee_empty();
425 return __A->getFEdge(*__B)->occludee_empty();
430 if (
__A ==
nullptr) {
431 return __B->z_discontinuity();
433 if (
__B ==
nullptr) {
434 return __A->z_discontinuity();
436 if (
__A->getFEdge(*
__B) ==
nullptr) {
440 return __A->getFEdge(*__B)->z_discontinuity();
444float CurvePoint::local_average_depth()
const
446 return local_average_depth_function<CurvePoint>(
this);
449float CurvePoint::local_depth_variance()
const
451 return local_depth_variance_function<CurvePoint>(
this);
454real CurvePoint::local_average_density(
float sigma)
const
457 return density_function<CurvePoint>(
this);
460Vec3r shaded_color()
const;
462Vec3r CurvePoint::orientation2d()
const
465 return __B->orientation2d();
468 return __A->orientation2d();
470 return __B->point2d() -
__A->point2d();
473Vec3r CurvePoint::orientation3d()
const
476 return __B->orientation3d();
479 return __A->orientation3d();
481 return __B->point3d() -
__A->point3d();
484real curvature2d()
const
486 return viewedge()->curvature2d((_VertexA->point2d() + _VertexB->point2d()) / 2.0);
489Vec3r CurvePoint::curvature2d_as_vector()
const
494 return edgeA + edgeB;
497 return __B->curvature2d_as_vector();
500 return __A->curvature2d_as_vector();
502 return ((1 -
_t2d) *
__A->curvature2d_as_vector() +
_t2d *
__B->curvature2d_as_vector());
505real CurvePoint::curvature2d_as_angle()
const
508 Vec3r edgeA = (_FEdges[0])->orientation2d();
509 Vec3r edgeB = (_FEdges[1])->orientation2d();
510 Vec2d N1(-edgeA.y(), edgeA.x());
512 Vec2d N2(-edgeB.y(), edgeB.x());
514 return acos((N1 * N2));
517 return __B->curvature2d_as_angle();
520 return __A->curvature2d_as_angle();
522 return ((1 -
_t2d) *
__A->curvature2d_as_angle() +
_t2d *
__B->curvature2d_as_angle());
525real CurvePoint::curvatureFredo()
const
528 return __B->curvatureFredo();
531 return __A->curvatureFredo();
533 return ((1 -
_t2d) *
__A->curvatureFredo() +
_t2d *
__B->curvatureFredo());
536Vec2d CurvePoint::directionFredo()
const
539 return __B->directionFredo();
542 return __A->directionFredo();
544 return ((1 -
_t2d) *
__A->directionFredo() +
_t2d *
__B->directionFredo());
561 for (vertex_container::iterator it =
_Vertices.begin(), itend =
_Vertices.end(); it != itend;
572Curve::point_iterator Curve::points_begin(
float step)
574 vertex_container::iterator second =
_Vertices.begin();
581Curve::const_point_iterator Curve::points_begin(
float step)
const
583 vertex_container::const_iterator second =
_Vertices.begin();
590Curve::point_iterator Curve::points_end(
float step)
603Curve::const_point_iterator Curve::points_end(
float step)
const
618Curve::point_iterator Curve::vertices_begin()
623Curve::const_point_iterator Curve::vertices_begin()
const
628Curve::point_iterator Curve::vertices_end()
633Curve::const_point_iterator Curve::vertices_end()
const
641 vertex_container::iterator second =
_Vertices.begin();
657 vertex_container::iterator last =
_Vertices.end();
683 vertex_container::iterator second =
_Vertices.begin();
700 vertex_container::iterator last =
_Vertices.end();
726Vec3r shaded_color(
int iCombination = 0)
const;
728Vec3r Curve::orientation2d(point_iterator it)
const
730 return (*it)->orientation2d();
733template<
class BaseVertex>
Vec3r Curve::orientation2d(
int iCombination)
const
735 return edge_orientation2d_function<Curve>(
this, iCombination);
738Vec3r Curve::orientation3d(point_iterator it)
const
740 return (*it)->orientation3d();
743Vec3r Curve::orientation3d(
int iCombination)
const
745 return edge_orientation3d_function<Curve>(
this, iCombination);
748real curvature2d(point_iterator it)
const
750 return (*it)->curvature2d();
753real curvature2d(
int iCombination = 0)
const;
759 for (;
v != vend; ++
v) {
760 if ((*v)->material() !=
mat) {
770 int qi_ = (*v)->qi();
771 for (;
v != vend; ++
v) {
772 if ((*v)->qi() != qi_) {
779occluder_container::const_iterator occluders_begin()
const
781 return _FEdgeA->occluders().begin();
784occluder_container::const_iterator occluders_end()
const
786 return _FEdgeA->occluders().end();
789int Curve::occluders_size()
const
794bool Curve::occluders_empty()
const
797 bool empty = (*v)->occluders_empty();
798 for (;
v != vend; ++
v) {
799 if ((*v)->occluders_empty() !=
empty) {
808 return *(_FEdgeA->aFace());
811const SShape *Curve::occluded_shape()
const
814 const SShape *sshape = (*v)->occluded_shape();
815 for (;
v != vend; ++
v) {
816 if ((*v)->occluded_shape() != sshape) {
823const bool Curve::occludee_empty()
const
826 bool empty = (*v)->occludee_empty();
827 for (;
v != vend; ++
v) {
828 if ((*v)->occludee_empty() !=
empty) {
834real Curve::z_discontinuity(
int iCombination)
const
836 return z_discontinuity_edge_function<Curve>(
this, iCombination);
839int Curve::shape_id()
const
842 Id
id = (*v)->shape_id();
843 for (;
v != vend; ++
v) {
844 if ((*v)->shape_id() !=
id) {
851const SShape *Curve::shape()
const
854 const SShape *sshape = (*v)->shape();
855 for (;
v != vend; ++
v) {
856 if ((*v)->shape() != sshape) {
863occluder_container::const_iterator Curve::occluders_begin()
const
866 return (*v)->occluders_begin();
869occluder_container::const_iterator Curve::occluders_end()
const
872 return (*v)->occluders_end();
875Vec3r Curve::curvature2d_as_vector(
int iCombination)
const
877 return curvature2d_as_vector_edge_function<Curve>(
this, iCombination);
880real Curve::curvature2d_as_angle(
int iCombination)
const
882 return curvature2d_as_angle_edge_function<Curve>(
this, iCombination);
885float Curve::shape_importance(
int iCombination)
const
887 return shape_importance_edge_function<Curve>(
this, iCombination);
890float Curve::local_average_depth(
int iCombination)
const
892 return local_average_depth_edge_function<Curve>(
this, iCombination);
895float Curve::local_depth_variance(
int iCombination)
const
897 return local_depth_variance_edge_function<Curve>(
this, iCombination);
899 local_depth_variance_functor<Point> functor;
901 Evaluate<float, local_depth_variance_functor<Point>>(&functor, iCombination,
result);
906real Curve::local_average_density(
float sigma,
int iCombination)
const
908 return density_edge_function<Curve>(
this, iCombination);
910 density_functor<Point> functor;
912 Evaluate<real, density_functor<Point>>(&functor, iCombination,
result);
920void Curve::computeCurvatureAndOrientation()
927 p0 =
Vec2d(p[0], p[1]);
931 p1 =
Vec2d(p[0], p[1]);
932 Vec2d prevDir(p1 - p0);
934 for (;
v ! = vend; ++
v) {
940 Vec3r p2 = (*v2)->point2d();
944 real lba = BA.
norm(), lbc = BC.norm();
947 Vec2d normalCurvature = BA + BC;
951 normal.normalizeSafe();
952 real curvature = normalCurvature * normal;
953 if (lba + lbc > MY_EPSILON) {
954 curvature /= (0.5 * lba + lbc);
956 if (dir.norm() < MY_EPSILON) {
959 (*v)->setCurvatureFredo(curvature);
960 (*v)->setDirectionFredo(dir);
968 (*v)->setCurvatureFredo((*prevV)->curvatureFredo());
969 (*v)->setDirectionFredo((*v)->point2d() - (*prevV)->point2d());
973 (*v0)->setCurvatureFredo((*v2)->curvatureFredo());
974 (*v0)->setDirectionFredo((*v2)->point2d() - (*v0)->point2d());
986 p0 =
Vec2d(p[0], p[1]);
990 p1 =
Vec2d(p[0], p[1]);
991 bool isReliable =
false;
992 if ((p1 - p0).
norm > EPS_CURVA) {
997 for (;
v != vend; ++
v) {
1003 Vec3r p2 = (*v2)->point2d();
1007 real lba = BA.
norm(), lbc = BC.norm();
1009 if ((lba + lbc) < EPS_CURVA) {
1017 for (; vfix !=
v; ++vfix) {
1018 (*vfix)->setCurvatureFredo((*v)->curvatureFredo());
1019 (*vfix)->setDirectionFredo((*v)->directionFredo());
Iterators used to iterate over the elements of the Curve. Can't be used in python.
Iterators used to iterate over the elements of the Curve.
Class to define a container for curves.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
virtual FEdge * getFEdge(Interface0D &inter)
int occluders_size() const
real z_discontinuity() const
CurvePoint & operator=(const CurvePoint &iBrother)
bool occluders_empty() const
occluder_container::const_iterator occluders_begin() const
const SShape * occluded_shape() const
virtual Nature::VertexNature getNature() const
const Vec3r & point2d() const
bool occludee_empty() const
virtual Vec2r getPoint2D() const
occluder_container::const_iterator occluders_end() const
const Polygon3r & occludee() const
const SShape * shape() const
point_iterator vertices_end()
vertex_container _Vertices
CurveInternal::__point_iterator< CurveInternal::CurvePoint_nonconst_traits > point_iterator
point_iterator points_end(float step=0)
CurveInternal::__point_iterator< CurveInternal::CurvePoint_const_traits > const_point_iterator
virtual Interface0DIterator pointsBegin(float t=0.0f)
CurveInternal::CurvePointIterator curvePointsBegin(float t=0.0f)
virtual Interface0DIterator pointsEnd(float t=0.0f)
point_iterator vertices_begin()
point_iterator points_begin(float step=0)
const_point_iterator const_vertex_iterator
CurveInternal::CurvePointIterator curvePointsEnd(float t=0.0f)
static int getException()
static int raiseException(exception_type exception=UNDEFINED)
virtual FEdge * getFEdge(Interface0D &)
const Vec3r & point3d() const
virtual Vec2r getPoint2D() const
float shape_importance() const
static real ImageToWorldParameter(FEdge *fe, real t)
Vec< T, N > & normalize()
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
VecMat::Vec2< double > Vec2d
VecMat::Vec3< real > Vec3r
static const VertexNature T_VERTEX