当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectHeader类代码示例

本文整理汇总了C++中ObjectHeader的典型用法代码示例。如果您正苦于以下问题:C++ ObjectHeader类的具体用法?C++ ObjectHeader怎么用?C++ ObjectHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObjectHeader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv)
{
    // Get geometric tolerance from the argument list.    
    double epsge = atof(argv[1]);

    // Read curve file
    //string inp_curve_filename("approj_curve.g2"); 
    //string inp_curve_filename("const_u_paramcurve.g2"); 
    string inp_curve_filename("const_v_paramcurve.g2"); 
    ifstream cfile(inp_curve_filename.c_str());
    if (!cfile) {
	cerr << "\nFile error. Could not open file: " << inp_curve_filename.c_str() << endl;
	return 1;
    }
    shared_ptr<SplineCurve> curve(new SplineCurve);
    ObjectHeader header;
    cfile >> header;
    if (!header.classType() == SplineCurve::classType()) {
	THROW("Object type is NOT SplineCurve.");
    }
    cfile >> (*curve);
    cfile.close();
    shared_ptr<ParamCurve> pcurve = curve;

    // Read surface file
    string inp_surf_filename("surface.g2");   
    ifstream sfile(inp_surf_filename.c_str());
    if (!sfile) {
	cerr << "\nFile error. Could not open file: " << inp_surf_filename.c_str() << endl;
	return 1;
    }
    shared_ptr<SplineSurface> surf(new SplineSurface);
    sfile >> header;
    if (!header.classType() == SplineSurface::classType()) {
	THROW("Object type is NOT SplineSurface.");
    }
    sfile >> (*surf);
    sfile.close();
    shared_ptr<ParamSurface> psurf = surf;

    // Create projection curves
    shared_ptr<SplineCurve> proj_cv;
    shared_ptr<SplineCurve> par_cv;
    CurveCreators::projectCurve(pcurve, psurf, epsge, proj_cv, par_cv);

    // Write 3D space curve to file.
    ofstream scvout("proj_space_curve.g2");
    //proj_cv->writeStandardHeader(scvout);
    scvout << "100 1 0 4 0 255 0  255" << endl; // write header. Green curve
    scvout << *proj_cv;    // write space spline curve data.
    scvout.close();

    // Write 2D parameter curve to file.
    ofstream pcvout("proj_param_curve.g2");
    par_cv->writeStandardHeader(pcvout); // write header
    pcvout << *par_cv;    // write parameter spline curve data.
    pcvout.close();

    return 0;
}
开发者ID:99731,项目名称:GoTools,代码行数:60,代码来源:project_curve.C

示例2: appendVariableSizedObject

void Outstation::appendVariableSizedObject( const ObjectHeader& h,
                                            const DnpObject& o)
{
    stats.logNormal( h.str( strbuf, sizeof(strbuf)));    
    h.encode( txFragment);
    appendUINT16( txFragment, o.size()); 
    o.encode( txFragment);
}
开发者ID:rickfoosusa,项目名称:dnp,代码行数:8,代码来源:outstation.cpp

示例3: main

int main(int argc, char** argv)
{
    string inp_curve_filename("approj_curve.g2"); 
    Point location(0.0, 5.0, 200.0);
    Point axis_dir(1.0, 0.0, 0.0);
    cout << "\nRunning program '" << argv[0] << "' with spline curve filename= '"
	 << inp_curve_filename.c_str() << "'." << endl;


    // Read spline curve file
    ifstream cfile(inp_curve_filename.c_str());
    if (!cfile) {
	cerr << "\nFile error. Could not open file: " << inp_curve_filename.c_str()
	     << endl;
	return 1;
    }
    shared_ptr<SplineCurve> spline_curve(new SplineCurve);
    ObjectHeader header;
    cfile >> header;
    if (!header.classType() == SplineCurve::classType()) {
	THROW("Object type is NOT SplineCurve.");
    }
    cfile >> (*spline_curve);
    cfile.close();

    // Print some curve information
    Point pnt3d(3);
    spline_curve->point(pnt3d, spline_curve->startparam());     
    cout << "\nSplineCurve:  Dim= " << spline_curve->dimension()
	 << "\nStart.  Param= " << spline_curve->startparam() << "  Point= "
	 << pnt3d << endl;
    spline_curve->point(pnt3d, spline_curve->endparam());    
    cout << "End.  Param= " << spline_curve->endparam() << "  Point= "
	 << pnt3d << endl;
    cout << "Bounding box =   " << spline_curve->boundingBox() << endl;

    // Create the SurfaceOfRevolution object.
    SurfaceOfRevolution surf_of_revolution(location, axis_dir, spline_curve);
    cout << "\nSurface:  Dim= " << surf_of_revolution.dimension() << endl;
    cout << "Bounding box =  " << surf_of_revolution.boundingBox() << endl;
    cout << "Location =  " << surf_of_revolution.getLocation() << endl;
    cout << "Axis direction =  " << surf_of_revolution.getAxisDir() << endl;


    // Make a SplineSurface representation and write to file.
    SplineSurface* spline_surf = surf_of_revolution.geometrySurface();
    ofstream fout("surface_of_revolution.g2");
    spline_surf->writeStandardHeader(fout);
    spline_surf->write(fout);
    fout.close();
    // cout << "\nOpen the files 'surface_of_revolution.g2' and 'approj_curve.g2'"
    //      << " in 'goview' to look at the results.\n" << endl;
    delete spline_surf;

    return 0;
}
开发者ID:99731,项目名称:GoTools,代码行数:56,代码来源:surface_of_revolution.C

示例4: main

int main(int argc, char** argv)
{
    ASSERT(argc >= 2);
    ifstream file(argv[1]);
    ObjectHeader head;
    SplineSurface sf;
    SplineCurve cv;
    file >> head;
    if (head.classType() == SplineSurface::classType()) { 
	file >> sf;
    } else if (head.classType() == SplineCurve::classType()) {
开发者ID:99731,项目名称:GoTools,代码行数:11,代码来源:test_closestpoint.C

示例5: main

int main(int argc, char** argv)
{
  if (argc != 2 && argc != 4)
    {
      std::cout << "Usage; infile (nmb u pts) (nmb v pts)" << std::endl;
      return -1;
    }

  std::ifstream infile(argv[1]);
  ObjectHeader head;
  head.read(infile);
  BoundedSurface gosf;
  gosf.read(infile);

  const RectDomain& dom = gosf.containingDomain();
  double start_u = dom.umin();
  double end_u = dom.umax();
  double start_v = dom.vmin();
  double end_v = dom.vmax();

  int nmb_u = 20, nmb_v = 20;
  if (argc == 4)
    {
      nmb_u = atoi(argv[2]);
      nmb_v = atoi(argv[3]);
    }
  double del_u = (end_u - start_u)/(double)(nmb_u-1);
  double del_v = (end_v - start_v)/(double)(nmb_v-1);

  vector<Point> inside;
  int ki, kj;
  double u, v;
  for (v=start_v, ki=0; ki<nmb_v; v+=del_v, ki++)
    for (u=start_u, kj=0; kj<nmb_u; u+=del_u, kj++)
      {
	Point curr;

	if (!gosf.inDomain(u,v))
	  continue;

	gosf.point(curr, u, v);
	inside.push_back(curr);
      }

  std::ofstream out_file("inside_pts.g2");
  out_file << "400 1 0 4 255 0 0 255" << std::endl;
  out_file << inside.size() << std::endl;
  for (ki=0; ki < (int)inside.size(); ki++)
    {
      out_file << inside[ki][0] << " " << inside[ki][1] << " ";
      out_file << inside[ki][2] << std::endl;
    }
}
开发者ID:99731,项目名称:GoTools,代码行数:53,代码来源:test_inDomain.C

示例6: os

  Object* Thread::unlock_locks(STATE, GCToken gct, CallFrame* calling_environment) {
    Thread* self = this;
    OnStack<1> os(state, self);

    LockedObjects& los = self->vm_->locked_objects();
    for(LockedObjects::iterator i = los.begin();
        i != los.end();
        ++i) {
      ObjectHeader* locked = *i;
      if(locked != self) {
        locked->unlock_for_terminate(state, gct, calling_environment);
      }
    }
    los.clear();
    return cNil;
  }
开发者ID:Red54,项目名称:rubinius,代码行数:16,代码来源:thread.cpp

示例7: main

int main(int argc, char** argv)
{
 
    if (argc != 6) {
	cout << "Usage: spline_sf x0 y0 z0 r" << endl;
	return 0;
    }

    ObjectHeader header;

    // Read the first curve from file
    ifstream filein(argv[1]);
    if (filein.bad()) {
	cerr << "File #1 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    double x0 = atof(argv[2]);
    double y0 = atof(argv[3]);
    double z0 = atof(argv[4]);
    double r = atof(argv[5]);

    header.read(filein);
    shared_ptr<ParamSurface> surf(new SplineSurface());
    surf->read(filein);
    filein.close();

    Point center(x0, y0, z0);    
    shared_ptr<SphereInt> sphere(new SphereInt(center, r));
//     double dummy_tol = 1e-03; // @@sbr Not yet used.
    shared_ptr<ParamObjectInt> par_obj_int(new ParamSurfaceInt(surf));
    shared_ptr<AlgObjectInt> alg_obj_int = sphere;

    shared_ptr<GeoTol> aepsge(new GeoTol(1.e-6));
    //IntersectorAlgPar int_alg_par(alg_obj_int, par_obj_int, aepsge);
    IntersectorAlgPar int_alg_par(sphere, par_obj_int, aepsge);

    int_alg_par.compute();
    std::vector<shared_ptr<IntersectionPoint> > int_points;
    std::vector<shared_ptr<IntersectionCurve> > int_curves;
    int_alg_par.getResult(int_points, int_curves);

    cout << "IntPoints found: " << int_points.size() << endl;
    cout << "IntCurves found: " << int_curves.size() << endl;

    return 0;
}
开发者ID:99731,项目名称:GoTools,代码行数:47,代码来源:test_SfSphereIntersector.C

示例8: WriteIdentifier

//-*****************************************************************************
void WriteIdentifier( const ObjectHeader &ohead )
{
    std::string name = ohead.getFullName();
    char* nameArray[] = { const_cast<char*>( name.c_str() ), RI_NULL };

    RiAttribute(const_cast<char*>( "identifier" ), const_cast<char*>( "name" ),
                nameArray, RI_NULL );
}
开发者ID:AWhetter,项目名称:alembic,代码行数:9,代码来源:WriteGeo.cpp

示例9: main

int main(int argc, char* argv[] )
{
    if (argc != 5)
    {
        std::cout << "Usage: " << argv[0]
                  << " input_ellipse tmin tmax output_subcurve" << endl;
        return -1;
    }

    // Open input surface file
    ifstream is(argv[1]);
    double tmin(atof(argv[2]));
    double tmax(atof(argv[3]));
    ofstream os(argv[4]);
    if (is.bad())
    {
        std::cout << "Bad or no input filename" << std::endl;
        return -1;
    }

    // Read surface from file
    ObjectHeader head;
    Ellipse ellipse; // Typically: centre, dir, normal, r1, r2.
    is >> head;
    ASSERT(head.classType() == Ellipse::classType());
    is >> ellipse;

    if (tmin < ellipse.startparam() || tmax > ellipse.endparam())
    {
        std::cout << "tmin or tmax outside domain of ellipse." << std::endl;
        return -1;
    }

    std::cout << "Writing to file." << std::endl;

    // Extract subcurve, write to file.
    ellipse.setParamBounds(tmin, tmax);

    shared_ptr<SplineCurve> sub_ellipse(ellipse.geometryCurve());

    sub_ellipse->writeStandardHeader(os);
    sub_ellipse->write(os);

    return 0;
}
开发者ID:VicoLiang,项目名称:GoTools,代码行数:45,代码来源:test_ellipse.C

示例10: main

int main(int argc, char** argv)
{
    if (argc < 3) {
	cerr << "Usage: " << argv[0] << " u_res v_res" << endl;
	return 1;
    }
    int ures = atoi(argv[1]);
    int vres = atoi(argv[2]);

    ObjectHeader head;
    cin >> head;
    ASSERT(head.classType() == SplineSurface::classType());
    SplineSurface sf;
    cin >> sf;
    vector<double> points;
    vector<double> param_u;
    vector<double> param_v;
    sf.gridEvaluator(ures, vres, points, param_u, param_v);
    RectGrid grid(ures, vres, sf.dimension(), &points[0]);
    grid.writeStandardHeader(cout);
    grid.write(cout);
}
开发者ID:99731,项目名称:GoTools,代码行数:22,代码来源:make_grid.C

示例11: main

int main(int argc, char *argv[])
{
    if (argc != 3)
    {
	std::cout << "Usage: sfs_file (.g2) repaired_sfs_file (.g2)" << std::endl;
	return -1;
    }

    std::ifstream filein(argv[1]); // Input bd sfs (may contain other objects).
    std::ofstream fileout(argv[2]); // Fixed bd sfs (and unaltered other objects).

    // For BoundedSurface we may choose to recreate all the boundary parameter curves.
    const bool recreate_par_cvs = true;
    if (recreate_par_cvs)
    {
	cout << "Recreating all parameter curve for CurveOnSurface." << endl;
    }

    // Create the default factory
    GoTools::init();

    ObjectHeader header;
    int num_bd_sfs = 0;
    int num_bd_sfs_fixed = 0;
    int num_bd_sfs_fix_failed = 0;
    int obj_id = 0;
    while (filein)
    {
	std::cout << "Object number: " << obj_id << std::endl;
	try {
	    header.read(filein);
	}
	catch (...)
	{
	    MESSAGE("Failed reading the Header!");
	    break; // Assuming we are either done or the rest of the file is garbage ...
	}

	shared_ptr<GeomObject> geom_obj(Factory::createObject(header.classType()));
	try
	{
	    geom_obj->read(filein);
	}
	catch (...)
	{
	    MESSAGE("Failed reading the GeomObject!");
	}
	if (geom_obj->instanceType() != Class_BoundedSurface)
	{
	    cout << "Writing to file an object of type :" << geom_obj->instanceType()<< endl;
	    geom_obj->writeStandardHeader(fileout);
	    geom_obj->write(fileout);
	} else if (geom_obj->instanceType() == Class_BoundedSurface)
	{
	    ++num_bd_sfs;
	    BoundedSurface* bd_sf = dynamic_cast<BoundedSurface*>(geom_obj.get());
	    double epsgeo = 1.5e-02;// bd_sf->getEpsGeo(); // The smallest for all the loops.
	    int valid_state = 0;
	    bool is_valid = bd_sf->isValid(valid_state);


#ifndef NDEBUG
	    std::ofstream debug("tmp/debug.g2");
	    ParamSurface* under_sf = bd_sf->underlyingSurface().get();
	    under_sf->writeStandardHeader(debug);
	    under_sf->write(debug);
	    for (int ki = 0; ki < bd_sf->numberOfLoops(); ++ki)
	    {
		shared_ptr<CurveLoop> loop = bd_sf->loop(ki);
		for (size_t kj = 0; kj < loop->size(); ++kj)
		{
		    shared_ptr<ParamCurve> cv = (*loop)[kj];
		    if (cv->instanceType() == Class_CurveOnSurface)
		    {
			shared_ptr<CurveOnSurface> cv_on_sf =
			    dynamic_pointer_cast<CurveOnSurface, ParamCurve>(cv);
			if (cv_on_sf->parameterCurve() != NULL) {
			    shared_ptr<SplineCurve> pcv =
				dynamic_pointer_cast<SplineCurve, ParamCurve>
				(cv_on_sf->parameterCurve());
			    if (pcv.get() != NULL)
				SplineDebugUtils::writeSpaceParamCurve(*pcv, debug, 0.0);
			    else
			    {
				cv_on_sf->parameterCurve()->writeStandardHeader(debug);
				cv_on_sf->parameterCurve()->write(debug);
			    }
			}
			if (cv_on_sf->spaceCurve() != NULL)
			{
			    cv_on_sf->spaceCurve()->writeStandardHeader(debug);
			    cv_on_sf->spaceCurve()->write(debug);
			}
		    }
		    else
		    {
			cv->writeStandardHeader(debug);
			cv->write(debug);
		    }
		}
//.........这里部分代码省略.........
开发者ID:heididahl,项目名称:GoTools,代码行数:101,代码来源:repairInvalidBoundedSurfaces.C

示例12: main

int main(int argc, char** argv)
{
    // Read the surface from a file in Go-format.
    string filename("degenerate_sf.g2");
    cout << "\nProgram " << argv[0] << " using file " << filename.c_str() << endl;
    ifstream file(filename.c_str());
    if (!file) {
	cerr << "\nFile error. Could not open file: " << filename.c_str() << endl;
	return 1;
    }
    ObjectHeader head;
    SplineSurface surf;
    file >> head;
    if (!head.classType() == SplineSurface::classType()) {
	THROW("Object type is NOT SplineSurface.");
    }
    file >> surf;
    file.close();

    // Read the points from a file. xyz-coordinates.
    string point_filename("inp_degen_surf_close_points.dat");
    ifstream pfile(point_filename.c_str());
    if (!pfile) {
	cerr << "\nFile error. Could not open file: " << point_filename.c_str() << endl;
	return 1;
    }
    vector<Point> points;
    while (1) {
	Point p(3);
	pfile >> p;
	if (!pfile) break;
	points.push_back(p);
    }
    pfile.close();
    int N = (int)points.size();
    
    cout << "\nProgram '" << argv[0] << "' using input files '" << filename.c_str()
	 << "' and '" << point_filename.c_str()
	 << ", and output file 'degen_surf_close_points.g2'." << endl;

    // Find the points on the surface closest to these points.
    double close_u;      // Closest point's u parameter.
    double close_v;      // Closest point's v parameter.
    Point  close_pt(3);  // Closest point's coordinates.
    double close_dist;   // Distance between the two points.
    double epsilon = 1e-8;  // Parameter tolerance

    // Write to file vectors from a point to the closest point on the surface.
    ofstream fout2("degenerate_sf_close_points.g2");
    // Class_LineCloud=410 MAJOR_VERSION=1 MINOR_VERSION=1 auxillary data=4
    // The four auxillary data values defines the colour (r g b alpha)
    fout2 << "410 1 0 4 255 0 0 255" << endl; // Header.
    fout2 << N << endl;

    // Find closest point using the whole surface. (The two last arguments
    // 'RectDomain* domain_of_interest' and 'double *seed' are by default
    // equal to 0).
    cout << "\nClosest points from inputfile points to points on the surface ";
    for (int i=0; i<N; ++i) {
	surf.closestPoint(points[i], close_u, close_v, close_pt, close_dist,
			  epsilon);
	fout2 << points[i] << ' ' <<  close_pt << endl;  // write vector
	cout << "Point: " << points[i] << "  Closest point: " << close_pt
	     << "\nParameter values= " <<  close_u << " , " <<  close_v
	     << "  Closest distance= " << close_dist << endl;
    }
    fout2.close();


    // Find closest point from points on the surface. Should be 0 + some tolerance.
    cout << "\nClosest points from points on the surface." << endl;
    const int nsp = 9;
    double du = (surf.endparam_u() - surf.startparam_u()) / (nsp-1);
    double dv = (surf.endparam_v() - surf.startparam_v()) / (nsp-1);
    cout << "Parameter u from " << surf.startparam_u() << " to " << surf.endparam_u()
	 << "  step "  << du << endl;
    cout << "Parameter v from " << surf.startparam_v() << " to " << surf.endparam_v()
	 << "  step "  << dv << endl;
    double max_dist = 0.0;
    Point point;
    for (double v=surf.startparam_v(); v<=surf.endparam_v(); v += dv) {
	for (double u=surf.startparam_u(); u<=surf.endparam_u(); u += du) {
	    surf.point(point, u, v);  // interpolate at u,v
	    surf.closestPoint(point, close_u, close_v, close_pt, close_dist,
			      epsilon);
#ifdef DEBUG
	    cout << "\n        Point: " << point << "\nClosest point: " << close_pt
		 << "\nParameter values= " <<  close_u << " , " <<  close_v
		 << "  Closest distance= " << close_dist << endl;
#endif
	}
	max_dist = std::max(close_dist, max_dist);
    }
    cout << "\nMaximum distance between an interpolated point and the "
	 << "corresponding input point is " << max_dist << '\n' << endl;

}
开发者ID:99731,项目名称:GoTools,代码行数:97,代码来源:closestpoint_degenerate_sf.C

示例13: main

int main(int argc, char** argv)
{
 
    if (argc != 4) {
	cout << "Usage: test_CvCvIntersector FileCv1 FileCv2 aepsge"
	     << endl;
	return 0;
    }


    ObjectHeader header;

    // Read the first curve from file
    ifstream input1(argv[1]);
    if (input1.bad()) {
	cerr << "File #1 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    header.read(input1);
    shared_ptr<ParamCurve> curve1(new SplineCurve());
    curve1->read(input1);
    input1.close();
    
    // Read the second curve from file
    ifstream input2(argv[2]);
    if (input2.bad()) {
	cerr << "File #2 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    header.read(input2);
    shared_ptr<ParamCurve> curve2(new SplineCurve());
    curve2->read(input2);
    input2.close();

    double aepsge;
    aepsge = atof(argv[3]);

//     cout << "\nFile : " << argv[2] << " Parameter range u: "
// 	 << curve1->startparam_u() <<" " << curve1->endparam_u()
// 	 << " Parameter range v: " << curve1->startparam_v() <<" " 
// 	 << curve1->endparam_v();

//     cout << "\nFile : " << argv[2] << " Parameter range u: "
// 	 << curve2->startparam_u() <<" " << curve2->endparam_u()
// 	 << " Parameter range v: " << curve2->startparam_v() <<" " 
// 	 << curve2->endparam_v() << endl;

    shared_ptr<ParamGeomInt> scurveint1 =
	shared_ptr<ParamGeomInt>(new SplineCurveInt (curve1));
    shared_ptr<ParamGeomInt> scurveint2 =
	shared_ptr<ParamGeomInt>(new SplineCurveInt (curve2));

    CvCvIntersector cvcvintersect (scurveint1, scurveint2, aepsge);
    cvcvintersect.compute();

    std::vector<shared_ptr<IntersectionPoint> > intpts;
    std::vector<shared_ptr<IntersectionCurve> > intcrv;
    cvcvintersect.getResult(intpts, intcrv);
    printf("Number of points: %d \n", int(intpts.size()));
    printf("Number of curves: %d \n", int(intcrv.size()));

    int ki, kj;
    for (ki=0; ki < int(intpts.size()); ki++) {
	std::vector<double> par = intpts[ki]->getPar();
	for (kj=0; kj<int(par.size()); kj++)
	    std::cout << par[kj] << " ";
	std::cout << std::endl;
    }

    return 0;
}
开发者ID:99731,项目名称:GoTools,代码行数:73,代码来源:test_CvCvIntersector.C

示例14: main

int main(int argc, char** argv)
{
    if (argc != 7) {
	cout << "Usage: test_curveSplineCurveInt FILE1 FILE2 "
	     << "pstart1 pstart2 pstop1 pstop2"
	     << endl;
	return 0;
    }
    double pstart1, pstart2, pstop1, pstop2;
    pstart1 = atof(argv[3]);
    pstart2 = atof(argv[4]);
    pstop1 = atof(argv[5]);
    pstop2 = atof(argv[6]);
    ObjectHeader header;

    // Read first curve from file
    ifstream input(argv[1]);
    if (input.bad()) {
	cerr << "File #1 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    header.read(input);
    shared_ptr<SplineCurve> curve1(new SplineCurve());
    curve1->read(input);
    input.close();

   
    
    // Read second curve from file
    ifstream input2(argv[2]);
    if (input2.bad()) {
	cerr << "File #2 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    header.read(input2);
    shared_ptr<SplineCurve> curve2(new SplineCurve());
    curve2->read(input2);
    input.close();

//     int prec = std::cout.precision(16);
    cout << "\nFile : " << argv[1] << " Parameter range: "
	 << curve1->startparam() <<" " << curve1->endparam();
    cout << "  Start: " << pstart1 << "  Stop: " << pstop1;
    cout << "\nFile : " << argv[2] << " Parameter range: "
	 << curve2->startparam() <<" " << curve2->endparam();
    cout << "  Start: " << pstart2 << "  Stop: " << pstop2 << endl;

    const double eps = 1.e-4;
    cout << "  Eps= " << eps << endl;

//     SplineCurveInt sci1(curve1);

//     SplineCurveInt sci2(curve2);

//     int istat;
//     istat = sci1.checkCoincidence(pstart1, pstop1, eps, &sci2,
// 				  pstart2, pstop2);

//     cout << "\nistat = " << istat;

//     if (istat==0)
// 	cout << "  Curves are not coinciding." << endl;
//     else
// 	cout << "  Curves are coinciding." << endl;

//     std::cout.precision(prec);  

    return 0;
}
开发者ID:99731,项目名称:GoTools,代码行数:71,代码来源:test_SplineCurveInt.C

示例15: main

int main(int argc, char** argv)
{
    if (argc != 4) {
	cout << "Usage: " << argv[0] << " FileSf FileCv aepsge" << endl;
	return 0;
    }

    ObjectHeader header;

    // Read the first curve from file
    ifstream input1(argv[1]);
    if (input1.bad()) {
	cerr << "File #1 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    header.read(input1);
    SplineSurface surf;
    surf.read(input1);
    input1.close();
    
    // Read the second curve from file
    ifstream input2(argv[2]);
    if (input2.bad()) {
	cerr << "File #2 error (no file or corrupt file specified)."
	     << std::endl;
	return 1;
    }
    header.read(input2);
    SplineCurve curve;
    curve.read(input2);
    input2.close();

    double aepsge;
    aepsge = atof(argv[3]);

    // Set up and run the intersection algorithm
    SISLCurve* pcurve = Curve2SISL(curve);
    SISLSurf* psurf = GoSurf2SISL(surf);

    double astart1 = curve.startparam();
    double estart2[] = { surf.startparam_u(), surf.startparam_v() };
    double aend1 = curve.endparam();
    double eend2[] = { surf.endparam_u(), surf.endparam_v() };
    cout << "astart1 = " << astart1 << endl
	 << "estart2[] = { " << estart2[0] << ", "
	 << estart2[1] << " }" << endl
	 << "aend1 = " << aend1 << endl
	 << "eend2[] = { " << eend2[0] << ", " 
	 << eend2[1] << " }" << endl;

    double anext1 = astart1;
    double enext2[] = { estart2[0], estart2[1] };
//     double anext1 = 0.0;
//     double enext2[] = { 2.0, 0.0 };
    cout << "anext1 = " << anext1 << endl
	 << "enext2[] = { " << enext2[0] << ", "
	 << enext2[1] << " }" << endl;

    double cpos1;
    double gpos2[2];
    int jstat = 0;
    cout << "jstat = " << jstat << endl;

    s1772(pcurve, psurf, aepsge, astart1, estart2, aend1, eend2,
	  anext1, enext2, &cpos1, gpos2, &jstat);

    // Write the results
    cout << "Results s1772:" << endl
	 << "jstat = " << jstat << endl
	 << "cpos1 = " << cpos1 << endl
	 << "gpos2[] = { " << gpos2[0] << ", "
	 << gpos2[1] << " }" << endl;

    return 0;

}
开发者ID:99731,项目名称:GoTools,代码行数:77,代码来源:test_SISLsfcv.C


注:本文中的ObjectHeader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。