void FitTest::createSingleCurve() { m_allGeo->create(1); BezierCurve * curve = new BezierCurve; CurveBuilder cb; cb.addVertex(Vector3F(-7.5f, 4.f, 5.f)); cb.addVertex(Vector3F(-7.5f, 6.f, 5.f)); cb.addVertex(Vector3F(-7.5f, 6.f, 1.f)); cb.addVertex(Vector3F(-7.5f, 2.f, 1.f)); cb.addVertex(Vector3F(-7.5f, 1.f, 1.f)); cb.addVertex(Vector3F(-2.5f, 1.f, 1.f)); cb.addVertex(Vector3F(.5f, 4.f, 1.f)); cb.addVertex(Vector3F(-2.f, 10.f, 6.01f)); cb.addVertex(Vector3F(5.f, 10.f, 5.99f)); cb.addVertex(Vector3F(5.f, 8.f, 4.01f)); cb.addVertex(Vector3F(4.f, 8.f, 2.03f)); cb.addVertex(Vector3F(4.f, 8.5f, 1.01f)); cb.addVertex(Vector3F(5.1f, 8.95f, 0.f)); cb.addVertex(Vector3F(3.1f, 8.95f, -3.f)); cb.finishBuild(curve); m_allGeo->setGeometry(curve, 0); }
void BccWorld::createTestCurveGeometry() { std::cout<<" gen 1 test curve"; m_curves->create(1, 9); m_curves->counts()[0] = 9; Vector3F * cvs = m_curves->points(); cvs[0].set(8.f + RandomFn11(), 1.f + RandomFn11(), 4.1f); cvs[1].set(2.f + RandomFn11(), 9.4f + RandomFn11(), 1.11f); cvs[2].set(14.f + RandomFn11(), 8.4f + RandomFn11(), -3.13f); cvs[3].set(12.f + RandomFn11(), 1.4f + RandomFn11(), 1.14f); cvs[4].set(19.f + RandomFn11(), 2.4f + RandomFn11(), 2.16f); cvs[5].set(20.f + RandomFn11(), 3.4f + RandomFn11(), 5.17f); cvs[6].set(18.f + RandomFn11(), 12.2f + RandomFn11(), 3.18f); cvs[7].set(12.f + RandomFn11(), 12.2f + RandomFn11(), 2.19f); cvs[8].set(13.f + RandomFn11(), 8.2f + RandomFn11(), -2.18f); for(unsigned i=0; i<9;i++) { cvs[i] -= Vector3F(12.f, 0.f, 0.f); cvs[i] *= 3.f; } m_allGeo = new GeometryArray; m_allGeo->create(1); CurveBuilder cb; unsigned i; for(i=0; i< 9; i++) cb.addVertex(cvs[i]); BezierCurve * c = new BezierCurve; cb.finishBuild(c); m_allGeo->setGeometry(c, 0); }
bool BccWorld::createCurveGeometryFromFile() { if(!readCurveDataFromFile()) return false; m_allGeo = new GeometryArray; m_allGeo->create(m_curves->numCurves()); const unsigned n = m_curves->numCurves(); m_allGeo = new GeometryArray; m_allGeo->create(n); unsigned * cc = m_curves->counts(); Vector3F * cvs = m_curves->points(); m_totalCurveLength = 0.f; CurveBuilder cb; unsigned ncv; unsigned cvDrift = 0; unsigned i, j; for(i=0; i< n; i++) { ncv = cc[i]; for(j=0; j < ncv; j++) cb.addVertex(cvs[j + cvDrift]); BezierCurve * c = new BezierCurve; cb.finishBuild(c); m_totalCurveLength += c->length(); m_allGeo->setGeometry(c, i); cvDrift += ncv; } std::cout<<" n curves "<<n <<" total curve length: "<<m_totalCurveLength<<"\n"; m_numCurves = n; return true; }