Esempio n. 1
0
//===========================================================================
SplineSurface* Torus::createNonRationalSpline(double eps) const
//===========================================================================
{
  // First fetch the first circular boundary curve in the minor
  // direction
  shared_ptr<Circle> circ = getMinorCircle(domain_.vmin());

  // Feth non-rational spline approximation
  shared_ptr<SplineCurve> crv(circ->createNonRationalSpline(0.5*eps));

  // Rotate this circle the valid angle around the main axis to 
  // create the non-rational spline surface
  // Note that the result will be rational if the tolerance is equal to zero
  int status;
  SISLCurve *qc = Curve2SISL(*crv);
  double *point = const_cast<double*>(location_.begin());
  double *axis =  const_cast<double*>(z_axis_.begin());
  SISLSurf *qs = NULL;
  s1302(qc, 0.5*eps, parbound_.umax()-parbound_.umin(), point, axis,
	&qs, &status);
  if (status < 0 || qs == NULL)
    return NULL;  // Approximation failed

  SplineSurface *surf = SISLSurf2Go(qs);
  surf->setParameterDomain(domain_.umin(), domain_.umax(),
			   domain_.vmin(), domain_.vmax());
  if (isSwapped())
    surf->swapParameterDirection();

  freeSurf(qs);
  return surf;
}
Esempio n. 2
0
//===========================================================================
SplineSurface* Torus::createSplineSurface() const
//===========================================================================
{
    double umin = domain_.umin();
    double umax = domain_.umax();

    shared_ptr<Circle> circle = getMinorCircle(umin);
    shared_ptr<SplineCurve> sccircle(circle->geometryCurve());
    double angle = parbound_.umax() - parbound_.umin();

    SplineSurface* sstorus 
	= SweepSurfaceCreator::rotationalSweptSurface(*sccircle, angle,
						      location_, z_axis_);
    sstorus->basis_u().rescale(umin, umax);

    if (isSwapped())
        sstorus->swapParameterDirection();

    return sstorus;
}