Hi, is it possible to find middle point of an edge considering its total length instead of parameters?
Thanks
Discussion
6 archived replies
Posts are displayed in their archived order.
01Commenter-1
I don't know the best way, but I do have a couple of suggestions you could try:
- You could try using GCPnts_UniformAbscissa to either generate 3 points or use an abscissa of 1/2 the arc length.
- You could compute 1/2 the arc length and compute the parameter of the midpoint using a weighted binary search like algorithm
In case you are not aware, you can use BRepGProp::LinearProperties to compute the length of an edge.
Where is my mistake here, do I get the adaptor wrong?
Thanks again
03Commenter-2
I don't understand the second line of the source well.
Simply, the following will work.
GeomAdaptor_Curve adaptor( aCurve )
04Commenter-2
About the length of Edge, I needed it the other day, so I examined a little.
a) How to calclate the length of curve
Handle(Geom_Curve) aCurve = ...;
GeomAdaptor_Curve c(aCurve );
len = GCPnts_AbscissaPoint::Length( c );
b) How to calculate the parameter at specified distance from the position ts,
GCPnts_AbscissaPoint calc( c, dist, ts );
if ( calc.IsDone() ) {
ti = calc.Parameter();
}
c) if you specify the second parameter of BRepAdaptor_CompCurve true, parameter is measured as distance.
BRepAdaptor_CompCurve c(TopoDS::Wire(aShape), Standard_True );