Exemple #1
0
bool ON_Surface::IsSolid() const
{
  const bool bIsClosed0 = ( IsClosed(0) || ( IsSingular(1) && IsSingular(3) ) );
  const bool bIsClosed1 = ( IsClosed(1) || ( IsSingular(0) && IsSingular(2) ) );

  if ( bIsClosed0 && bIsClosed1 )
    return true;

  const ON_Extrusion* extrusion = ON_Extrusion::Cast(this);
  if ( 0 != extrusion && extrusion->IsSolid() )
    return true;

  return false;
}
Exemple #2
0
bool ON_NurbsSurface::Morph( const ON_SpaceMorph& morph )
{
  DestroySurfaceTree();
  ON_BOOL32 bIsClosed[2];
  ON_BOOL32 bIsPeriodic[2];
  ON_BOOL32 bIsSingular[4];

  int i;
  for ( i = 0; i < 2; i++ )
  {
    bIsClosed[i] = IsClosed(i);
    bIsPeriodic[i] = IsPeriodic(i);
  }

  for ( i = 0; i < 4; i++ )
    bIsSingular[i] = IsSingular(i);

  for ( i = 0; i < m_cv_count[0]; i++ )
  {
    morph.MorphPointList( m_dim, m_is_rat, 
                          m_cv_count[1], m_cv_stride[1], 
                          CV(i,0) );
  }

  for ( i = 0; i < 4; i++ )
  {
    if ( bIsSingular[i] )
      CollapseSide(i);
  }

  // TODO - if input was closed/periodic make output the same

  return true;
}
Exemple #3
0
bool 
ON_Surface::IsAtSingularity(double s, double t,
                            bool bExact //true by default
                            ) const

{
  if (bExact){
    if (s == Domain(0)[0]){
      if (IsSingular(3))
        return true;
    }
    else if (s == Domain(0)[1]){
      if (IsSingular(1))
        return true;
    }
    if (t == Domain(1)[0]){
      if (IsSingular(0))
        return true;
    }
    else if (t == Domain(1)[1]){
      if (IsSingular(2))
        return true;
    }
    return false;
  }

  if (IsAtSingularity(s, t, true))
    return true;

  bool bCheckPartials[2] = {false, false};
  int i;

  double m[2];
  for (i=0; i<2; i++)
    m[i] = Domain(i).Mid();
  if (s < m[0]){
    if (IsSingular(3))
      bCheckPartials[1] = true;
  }
  else {
    if (IsSingular(1))
      bCheckPartials[1] = true;
  }
  if (!bCheckPartials[0] && !bCheckPartials[1]){
    if (t < m[1]){
      if (IsSingular(0))
        bCheckPartials[0] = true;
    }
    else {
      if (IsSingular(2))
        bCheckPartials[0] = true;
    }
  }

  if (!bCheckPartials[0] && !bCheckPartials[1])
    return false;

  ON_3dPoint P;
  ON_3dVector M[2], S[2];
  if (!Ev1Der(s, t, P, S[0], S[1]))
    return false;
  if (!Ev1Der(m[0], m[1], P, M[0], M[1]))
    return false;

  for (i=0; i<2; i++){
    if (!bCheckPartials[i])
      continue;
    if (S[i].Length() < 1.0e-6 * M[i].Length())
      return true;
  }

  return false;

}