Example #1
0
bool EarClipper::isInsideOfTriangle(Point2D a, Point2D b, Point2D c, Point2D i) {
    Vector2D vai(a, i);
    Vector2D vic(i, c);
    Vector2D vib(i, b);
    Vector2D vci(c, i);

    return ((vai.orientation(vic) < 0 && vai.orientation(vib) > 0 && vci.orientation(vib) < 0) ||
            (vai.orientation(vic) > 0 && vai.orientation(vib) < 0 && vci.orientation(vib) > 0));
}
Example #2
0
void CRegionalMetaModel::ReadTrainingData( const string& strDataFile, int nInputs, int nOutputs, vector< vector<REAL> >& vcInputs, vector< vector<REAL> >& vcOutputs )
{
	ifstream ifg( strDataFile.c_str() );
	char buf[_MAX_LINE];
	while( true ){
		ifg.getline( buf, ELEMENTS(buf) );
		if( ifg.fail() || ifg.eof() )break;

		istrstream istr(buf);
		vector<REAL> vci(nInputs);
		for( int i=0; i<nInputs; i++ )istr>>vci[i];

		vector<REAL> vco(nOutputs);
		for( i=0; i<nOutputs; i++ )istr>>vco[i];

		vcInputs.push_back( vector<REAL>() );
		vcInputs.back().swap( vci );

		vcOutputs.push_back( vector<REAL>() );
		vcOutputs.back().swap( vco );
	}
}