{
HYDROData_Object::Update();
- TopoDS_Shape aShape = CreateProfileWire( false );
+ TopoDS_Shape aShape = CreateProfileWire( true );
SetShape3D( aShape );
}
thePoint = GetParametricPoints().First();
- thePoint.SetX( 0 );
+ //thePoint.SetX( 0 );
thePoint.SetY( 0 ); //default left point of not-georeferenced profile
TDF_Label aLabel = myLab.FindChild( DataTag_FirstPoint, false );
if ( aLabel.IsNull() )
return false;
thePoint = GetParametricPoints().Last();
+ thePoint.SetY( 0 );
TDF_Label aLabel = myLab.FindChild( DataTag_LastPoint, false );
if ( aLabel.IsNull() )
const HYDROData_ProfileUZ::Point& aFirstParPoint = aParametricPoints.First();
const HYDROData_ProfileUZ::Point& aLastParPoint = aParametricPoints.Last();
- double aGeoDistance = gp_Pnt2d( aFirstPoint ).Distance( aLastPoint );
- double aParCommonDist = gp_Pnt2d( aFirstParPoint.X(), 0 ).Distance( gp_Pnt2d( aLastParPoint.X(), 0 ) );
+ double aFullLength = aLastPoint.X() - aFirstPoint.X();
+ double aParFullLength = aLastParPoint.X() - aFirstParPoint.X();
// Add first point as is
aResPoints.Append( ProfilePoint( aFirstPoint.X(), aFirstPoint.Y(), aFirstParPoint.Y() ) );
{
const HYDROData_ProfileUZ::Point& aParPoint = aParametricPoints.Value( i );
- double aParPointDist = gp_Pnt2d( aFirstParPoint.X(), 0 ).Distance( gp_Pnt2d( aParPoint.X(), 0 ) );
-
- double aParLen = ( aParPointDist / aParCommonDist ) * aGeoDistance;
-
- double aRatio = aParLen / ( aGeoDistance - aParLen );
+ double aParPointDist = aParPoint.X() - aFirstParPoint.X();
+ double aRatio = aParPointDist / aParFullLength;
- double aParX = ( aFirstPoint.X() + aRatio * aLastPoint.X() ) / ( 1 + aRatio );
- double aParY = ( aFirstPoint.Y() + aRatio * aLastPoint.Y() ) / ( 1 + aRatio );
+ double aParX = aFirstPoint.X() * (1-aRatio) + aLastPoint.X() * aRatio;
+ double aParY = aFirstPoint.Y() * (1-aRatio) + aLastPoint.Y() * aRatio;
ProfilePoint aCompPoint( aParX, aParY, aParPoint.Y() );
aResPoints.Append( aCompPoint );
return aBottom;
}
- HYDROData_Profile::ProfilePoint HYDROData_Profile::GetMiddlePoint() const
+ HYDROData_Profile::ProfilePoint HYDROData_Profile::GetMiddlePoint( bool CanUseDefault ) const
{
ProfilePoint aMiddlePoint;
gp_XY aLeftPnt, aRightPnt;
- if ( GetLeftPoint( aLeftPnt, false ) && GetRightPoint( aRightPnt, false ) ) {
+ if ( GetLeftPoint( aLeftPnt, true, CanUseDefault ) && GetRightPoint( aRightPnt, true, CanUseDefault ) ) {
gp_XYZ aPnt1( aLeftPnt.X(), aLeftPnt.Y(), 0. );
gp_XYZ aPnt2( aRightPnt.X(), aRightPnt.Y(), 0. );
gp_Pnt aMiddlePoint2d( 0.5 * ( aPnt1 + aPnt2 ) );