_y_max=(_y_max-yBary)/dimChar;
}
+/*!
+ * See Node::unApplySimilarity to see signification of params.
+ */
+void Bounds::unApplySimilarity(double xBary, double yBary, double dimChar)
+{
+ _x_min=_x_min*dimChar+xBary;
+ _x_max=_x_max*dimChar+xBary;
+ _y_min=_y_min*dimChar+yBary;
+ _y_max=_y_max*dimChar+yBary;
+}
+
void Bounds::getBarycenter(double& xBary, double& yBary) const
{
xBary=(_x_min+_x_max)/2.;
double getDiagonal() const;
void getBarycenter(double& xBary, double& yBary) const;
void applySimilarity(double xBary, double yBary, double dimChar);
+ void unApplySimilarity(double xBary, double yBary, double dimChar);
Bounds& operator=(const Bounds& other) { _x_min=other._x_min; _x_max=other._x_max; _y_min=other._y_min; _y_max=other._y_max; return *this; }
Bounds(double xMin, double xMax, double yMin, double yMax):_x_min(xMin),_x_max(xMax),_y_min(yMin),_y_max(yMax) { }
void setValues(double xMin, double xMax, double yMin, double yMax) { _x_min=xMin; _x_max=xMax; _y_min=yMin; _y_max=yMax; }
return dimChar;
}
+/*!
+ * This method operates the opposite operation than ComposedEdge::applyGlobalSimilarity.
+ */
+void ComposedEdge::unApplyGlobalSimilarityExt(ComposedEdge& other, double xBary, double yBary, double fact)
+{
+ std::set<Node *> allNodes;
+ getAllNodes(allNodes);
+ other.getAllNodes(allNodes);
+ for(std::set<Node *>::iterator iter=allNodes.begin();iter!=allNodes.end();iter++)
+ (*iter)->unApplySimilarity(xBary,yBary,fact);
+ for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ (*iter)->unApplySimilarity(xBary,yBary,fact);
+}
+
double ComposedEdge::normalizeExt(ComposedEdge *other, double& xBary, double& yBary)
{
Bounds b;
void getBarycenterGeneral(double *bary) const;
double normalize(ComposedEdge *other, double& xBary, double& yBary);
double normalizeExt(ComposedEdge *other, double& xBary, double& yBary);
+ void unApplyGlobalSimilarityExt(ComposedEdge& other, double xBary, double yBary, double fact);
void fillBounds(Bounds& output) const;
void applySimilarity(double xBary, double yBary, double dimChar);
void applyGlobalSimilarity(double xBary, double yBary, double dimChar);
_bounds.applySimilarity(xBary,yBary,dimChar);
}
+void Edge::unApplySimilarity(double xBary, double yBary, double dimChar)
+{
+ _bounds.unApplySimilarity(xBary,yBary,dimChar);
+}
+
bool Edge::Intersect(const Edge *f1, const Edge *f2, EdgeIntersector *intersector, const Bounds *whereToFind, MergePoints& commonNode,
ComposedEdge& outValForF1, ComposedEdge& outValForF2)
{
virtual double getAreaOfZone() const = 0;
//! apply a similiraty transformation on 'this'
virtual void applySimilarity(double xBary, double yBary, double dimChar);
+ //! apply the inverse similiraty transformation on 'this'
+ virtual void unApplySimilarity(double xBary, double yBary, double dimChar);
//! return the length of arc. Value is always > 0. !
virtual double getCurveLength() const = 0;
virtual void getBarycenter(double *bary) const = 0;
_center[1]=(_center[1]-yBary)/dimChar;
}
+void EdgeArcCircle::unApplySimilarity(double xBary, double yBary, double dimChar)
+{
+ Edge::applySimilarity(xBary,yBary,dimChar);
+ _radius*=dimChar;
+ _center[0]=_center[0]*dimChar+xBary;
+ _center[1]=_center[1]*dimChar+yBary;
+}
+
/*!
* Given an \b NON normalized vector 'vect', returns its norm 'normVect' and its
* angle in ]-Pi,Pi] relative to Ox axe.
void getCenter(double *center) const { center[0]=_center[0]; center[1]=_center[1]; }
bool doIHaveSameDirectionAs(const Edge& other) const { return false; }
void applySimilarity(double xBary, double yBary, double dimChar);
+ void unApplySimilarity(double xBary, double yBary, double dimChar);
double getAngle0() const { return _angle0; }
double getRadius() const { return _radius; }
double getAngle() const { return _angle; }
void getBarycenterOfZone(double *bary) const;
void fillBounds(Bounds& output) const;
void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); }
+ void unApplySimilarity(double xBary, double yBary, double dimChar) { _ptr->unApplySimilarity(xBary,yBary,dimChar); }
void getAllNodes(std::set<Node *>& output) const;
void getBarycenter(double *bary, double& weigh) const;
ElementaryEdge *clone() const;
}
else
{
- Edge *e=new EdgeArcCircle(st0,middle0,endd0,direct);
+ Edge *e=new EdgeArcCircle(st0,middle0,endd0,true);
for(std::size_t j=0;j<nbOfSubEdges;j++)
appendSubEdgeFromCrudeDataArray(e,j,direct,edgeId,subEdge,mapp);
e->decrRef();
nbOther.push_back(idOther);
delete *it;
}
+ unApplyGlobalSimilarityExt(other,xBaryBB,yBaryBB,fact);
}
/*!