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)) ||
208 if (
__B ==
nullptr) {
209 if (iVertexB->
__B ==
nullptr) {
212 if (iVertexB->
__A ==
__A) {
215 if (iVertexB->
__B ==
__A) {
219 if (iVertexB->
__B ==
nullptr) {
220 if (iVertexB->
__A ==
__A) {
223 if (iVertexB->
__A ==
__B) {
227 if (
__B == iVertexB->
__A) {
228 if ((
_t2d != 1) && (iVertexB->
_t2d == 0)) {
231 if ((
_t2d == 1) && (iVertexB->
_t2d != 0)) {
235 if (
__B == iVertexB->
__B) {
236 if ((
_t2d != 1) && (iVertexB->
_t2d == 1)) {
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)) {
251 if (
__A == iVertexB->
__B) {
252 if ((
_t2d == 0) && (iVertexB->
_t2d != 1)) {
255 if ((
_t2d != 0) && (iVertexB->
_t2d == 1)) {
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) {
288 if (
__A ==
nullptr) {
301 return ((1 - t3d) * Na + t3d * Nb);
305Material CurvePoint::material()
const
308 return __B->material();
310 return __A->material();
313Id CurvePoint::shape_id()
const
324 if (
__A ==
nullptr) {
331float CurvePoint::shape_importance()
const
339const uint CurvePoint::qi()
const
353 if (
__A ==
nullptr) {
356 if (
__B ==
nullptr) {
364 if (
__A ==
nullptr) {
367 if (
__B ==
nullptr) {
375 if (
__A ==
nullptr) {
378 if (
__B ==
nullptr) {
386 if (
__A ==
nullptr) {
389 if (
__B ==
nullptr) {
397 if (
__A ==
nullptr) {
400 if (
__B ==
nullptr) {
408 if (
__A ==
nullptr) {
411 if (
__B ==
nullptr) {
419 if (
__A ==
nullptr) {
422 if (
__B ==
nullptr) {
430 if (
__A ==
nullptr) {
433 if (
__B ==
nullptr) {
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();
473Vec3r CurvePoint::orientation3d()
const
476 return __B->orientation3d();
479 return __A->orientation3d();
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;
571Curve::point_iterator Curve::points_begin(
float step)
573 vertex_container::iterator second =
_Vertices.begin();
580Curve::const_point_iterator Curve::points_begin(
float step)
const
582 vertex_container::const_iterator second =
_Vertices.begin();
589Curve::point_iterator Curve::points_end(
float step)
602Curve::const_point_iterator Curve::points_end(
float step)
const
617Curve::point_iterator Curve::vertices_begin()
622Curve::const_point_iterator Curve::vertices_begin()
const
627Curve::point_iterator Curve::vertices_end()
632Curve::const_point_iterator Curve::vertices_end()
const
640 vertex_container::iterator second =
_Vertices.begin();
656 vertex_container::iterator last =
_Vertices.end();
682 vertex_container::iterator second =
_Vertices.begin();
699 vertex_container::iterator last =
_Vertices.end();
725Vec3r shaded_color(
int iCombination = 0)
const;
727Vec3r Curve::orientation2d(point_iterator it)
const
729 return (*it)->orientation2d();
732template<
class BaseVertex>
Vec3r Curve::orientation2d(
int iCombination)
const
734 return edge_orientation2d_function<Curve>(
this, iCombination);
737Vec3r Curve::orientation3d(point_iterator it)
const
739 return (*it)->orientation3d();
742Vec3r Curve::orientation3d(
int iCombination)
const
744 return edge_orientation3d_function<Curve>(
this, iCombination);
747real curvature2d(point_iterator it)
const
749 return (*it)->curvature2d();
752real curvature2d(
int iCombination = 0)
const;
757 const Material &mat = (*v)->material();
758 for (;
v != vend; ++
v) {
759 if ((*v)->material() != mat) {
769 int qi_ = (*v)->qi();
770 for (;
v != vend; ++
v) {
771 if ((*v)->qi() != qi_) {
778occluder_container::const_iterator occluders_begin()
const
780 return _FEdgeA->occluders().begin();
783occluder_container::const_iterator occluders_end()
const
785 return _FEdgeA->occluders().end();
788int Curve::occluders_size()
const
793bool Curve::occluders_empty()
const
796 bool empty = (*v)->occluders_empty();
797 for (;
v != vend; ++
v) {
798 if ((*v)->occluders_empty() !=
empty) {
805const Polygon3r &occludee()
const
807 return *(_FEdgeA->aFace());
810const SShape *Curve::occluded_shape()
const
813 const SShape *sshape = (*v)->occluded_shape();
814 for (;
v != vend; ++
v) {
815 if ((*v)->occluded_shape() != sshape) {
822const bool Curve::occludee_empty()
const
825 bool empty = (*v)->occludee_empty();
826 for (;
v != vend; ++
v) {
827 if ((*v)->occludee_empty() !=
empty) {
833real Curve::z_discontinuity(
int iCombination)
const
835 return z_discontinuity_edge_function<Curve>(
this, iCombination);
838int Curve::shape_id()
const
841 Id
id = (*v)->shape_id();
842 for (;
v != vend; ++
v) {
843 if ((*v)->shape_id() !=
id) {
850const SShape *Curve::shape()
const
853 const SShape *sshape = (*v)->shape();
854 for (;
v != vend; ++
v) {
855 if ((*v)->shape() != sshape) {
862occluder_container::const_iterator Curve::occluders_begin()
const
865 return (*v)->occluders_begin();
868occluder_container::const_iterator Curve::occluders_end()
const
871 return (*v)->occluders_end();
874Vec3r Curve::curvature2d_as_vector(
int iCombination)
const
876 return curvature2d_as_vector_edge_function<Curve>(
this, iCombination);
879real Curve::curvature2d_as_angle(
int iCombination)
const
881 return curvature2d_as_angle_edge_function<Curve>(
this, iCombination);
884float Curve::shape_importance(
int iCombination)
const
886 return shape_importance_edge_function<Curve>(
this, iCombination);
889float Curve::local_average_depth(
int iCombination)
const
891 return local_average_depth_edge_function<Curve>(
this, iCombination);
894float Curve::local_depth_variance(
int iCombination)
const
896 return local_depth_variance_edge_function<Curve>(
this, iCombination);
898 local_depth_variance_functor<Point> functor;
900 Evaluate<float, local_depth_variance_functor<Point>>(&functor, iCombination,
result);
905real Curve::local_average_density(
float sigma,
int iCombination)
const
907 return density_edge_function<Curve>(
this, iCombination);
909 density_functor<Point> functor;
911 Evaluate<real, density_functor<Point>>(&functor, iCombination,
result);
919void Curve::computeCurvatureAndOrientation()
926 p0 =
Vec2d(p[0], p[1]);
930 p1 =
Vec2d(p[0], p[1]);
931 Vec2d prevDir(p1 - p0);
933 for (;
v ! = vend; ++
v) {
939 Vec3r p2 = (*v2)->point2d();
943 real lba = BA.
norm(), lbc = BC.norm();
946 Vec2d normalCurvature = BA + BC;
950 normal.normalizeSafe();
951 real curvature = normalCurvature * normal;
952 if (lba + lbc > MY_EPSILON) {
953 curvature /= (0.5 * lba + lbc);
955 if (dir.norm() < MY_EPSILON) {
958 (*v)->setCurvatureFredo(curvature);
959 (*v)->setDirectionFredo(dir);
967 (*v)->setCurvatureFredo((*prevV)->curvatureFredo());
968 (*v)->setDirectionFredo((*v)->point2d() - (*prevV)->point2d());
972 (*v0)->setCurvatureFredo((*v2)->curvatureFredo());
973 (*v0)->setDirectionFredo((*v2)->point2d() - (*v0)->point2d());
985 p0 =
Vec2d(p[0], p[1]);
989 p1 =
Vec2d(p[0], p[1]);
990 bool isReliable =
false;
991 if ((p1 - p0).
norm > EPS_CURVA) {
996 for (;
v != vend; ++
v) {
1002 Vec3r p2 = (*v2)->point2d();
1006 real lba = BA.norm(), lbc = BC.norm();
1008 if ((lba + lbc) < EPS_CURVA) {
1016 for (; vfix !=
v; ++vfix) {
1017 (*vfix)->setCurvatureFredo((*v)->curvatureFredo());
1018 (*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)
point_iterator points_begin(float step=0)
virtual Interface0DIterator pointsEnd(float t=0.0f)
point_iterator vertices_begin()
const_point_iterator const_vertex_iterator
CurveInternal::CurvePointIterator curvePointsEnd(float t=0.0f)
static int getException()
static int raiseException(exception_type exception=UNDEFINED)
bool occluders_empty() const
int occluders_size() const
occluder_container::const_iterator occluders_end() const
occluder_container::const_iterator occluders_begin() const
const SShape * occluded_shape() const
real z_discontinuity() const
const Polygon3r & occludee() const
bool occludee_empty() const
const SShape * occluded_shape() const
virtual FEdge * getFEdge(Interface0D &)
real z_discontinuity() const
occluder_container::const_iterator occluders_begin() const
bool occluders_empty() const
const Vec3r & point3d() const
virtual Vec2r getPoint2D() const
occluder_container::const_iterator occluders_end() const
const Vec3r & point2d() const
int occluders_size() const
const Polygon3r & occludee() const
bool occludee_empty() const
float shape_importance() const
static real ImageToWorldParameter(FEdge *fe, real t)
Vec< T, N > & normalize()
VecMat::Vec2< double > Vec2d
VecMat::Vec3< real > Vec3r
static const VertexNature T_VERTEX