示例#1
0
void Surf::FindBorderCurves()
{
    double degen_tol = 0.000001;

    //==== Load 4 Border Curves if Not Degenerate ====//
    SCurve* scrv;
    double min_u = m_SurfCore.GetMinU();
    double min_w = m_SurfCore.GetMinW();
    double max_u = m_SurfCore.GetMaxU();
    double max_w = m_SurfCore.GetMaxW();

    vector< vec3d > pnts;
    pnts.resize( 2 );

    pnts[0].set_xyz( min_u, min_w, 0 );         // Inc U
    pnts[1].set_xyz( max_u, min_w, 0 );

    scrv = new SCurve( this );
    scrv->BuildBezierCurve( pnts, 0.25 );

    if ( scrv->Length( 10 ) > degen_tol )
    {
        m_SCurveVec.push_back( scrv );
    }
    else
    {
        delete scrv;
    }

    pnts[0].set_xyz( max_u, min_w, 0 );       // Inc W
    pnts[1].set_xyz( max_u, max_w, 0 );

    scrv = new SCurve( this );
    scrv->BuildBezierCurve( pnts, 0.25 );

    if ( scrv->Length( 10 ) > degen_tol )
    {
        m_SCurveVec.push_back( scrv );
    }
    else
    {
        delete scrv;
    }

    pnts[0].set_xyz( max_u, max_w, 0 );         // Dec U
    pnts[1].set_xyz( min_u, max_w, 0 );

    scrv = new SCurve( this );
    scrv->BuildBezierCurve( pnts, 0.25 );

    if ( scrv->Length( 10 ) > degen_tol )
    {
        m_SCurveVec.push_back( scrv );
    }
    else
    {
        delete scrv;
    }

    pnts[0].set_xyz( min_u, max_w,   0 );           // Dec W
    pnts[1].set_xyz( min_u, min_w,       0 );

    scrv = new SCurve( this );
    scrv->BuildBezierCurve( pnts, 0.25 );

    if ( scrv->Length( 10 ) > degen_tol )
    {
        m_SCurveVec.push_back( scrv );
    }
    else
    {
        delete scrv;
    }
}
示例#2
0
文件: Surf.cpp 项目: amgary/OpenVSP
void Surf::FindBorderCurves()
{
	double degen_tol = 0.000001;

	//==== Load 4 Border Curves if Not Degenerate ====//
	SCurve* scrv;
	double max_u = (m_NumU-1)/3.0;
	double max_w = (m_NumW-1)/3.0;

	vector< vec3d > pnts;
	pnts.resize( 4 );

	pnts[0].set_xyz( 0,		    0, 0 );			// Inc U
	pnts[1].set_xyz( max_u/2,   0, 0 );
	pnts[2].set_xyz( max_u/2, 0, 0 );
	pnts[3].set_xyz( max_u,     0, 0 );

	scrv = new SCurve( this );
	scrv->SetBezierControlPnts( pnts );

	if ( scrv->Length(10) > degen_tol )
		m_SCurveVec.push_back( scrv );
	else
		delete scrv;

	pnts[0].set_xyz( max_u,		  0, 0 );		// Inc W
	pnts[1].set_xyz( max_u,   max_w/2, 0 );
	pnts[2].set_xyz( max_u,   max_w/2, 0 );
	pnts[3].set_xyz( max_u,     max_w, 0 );

	scrv = new SCurve( this );
	scrv->SetBezierControlPnts( pnts );

	if ( scrv->Length(10) > degen_tol )
		m_SCurveVec.push_back( scrv );
	else
		delete scrv;

	pnts[0].set_xyz( max_u,	    max_w, 0 );			// Dec U
	pnts[1].set_xyz( max_u/2,	max_w, 0 );
	pnts[2].set_xyz( max_u/2,	max_w, 0 );
	pnts[3].set_xyz( 0,	        max_w, 0 );

	scrv = new SCurve( this );
	scrv->SetBezierControlPnts( pnts );

	if ( scrv->Length(10) > degen_tol )
		m_SCurveVec.push_back( scrv );
	else
		delete scrv;

	pnts[0].set_xyz( 0,	max_w,   0 );			// Dec W
	pnts[1].set_xyz( 0,	max_w/2, 0 );
	pnts[2].set_xyz( 0,	max_w/2, 0 );
	pnts[3].set_xyz( 0,	0,       0 );

	scrv = new SCurve( this );
	scrv->SetBezierControlPnts( pnts );

	if ( scrv->Length(10) > degen_tol )
		m_SCurveVec.push_back( scrv );
	else
		delete scrv;
}