Esempio n. 1
0
RH_C_FUNCTION ON_Brep* ON_Brep_CopyTrims( const ON_BrepFace* pConstBrepFace, const ON_Surface* pConstSurface, double tolerance)
{
  ON_Brep* rc = NULL;

  if( pConstBrepFace && pConstSurface )
  {
    ON_Brep* brep = pConstBrepFace->Brep();
    int fi = pConstBrepFace->m_face_index;

    ON_Brep* brp = brep->DuplicateFace(fi, FALSE);
    ON_Surface* srf = pConstSurface->DuplicateSurface();
    
    int si = brp->AddSurface(srf);
    brp->m_F[0].ChangeSurface(si);

    if (brp->RebuildEdges(brp->m_F[0], tolerance, TRUE, TRUE))
    { brp->Compact(); }
    else
    { delete brp; }

    rc = brp;
  }

  return rc;
}
Esempio n. 2
0
/* TODO - Need to find a more compact, efficient way to
 * do this - shouldn't need 24 3d curves... */
ON_Brep *
Cobb_Sphere(double UNUSED(radius), ON_3dPoint *UNUSED(origin))
{
    ON_Brep *b = ON_Brep::New();

    // Patch 1 of 6
    ON_BezierSurface *b1 = ON_CobbSphereFace(0, 0);
    ON_NurbsSurface *p1_nurb = ON_NurbsSurface::New();
    b1->GetNurbForm(*p1_nurb);
    b->NewFace(*p1_nurb);

    // Patch 2 of 6
    ON_BezierSurface *b2 = ON_CobbSphereFace(90, 0);
    ON_NurbsSurface *p2_nurb = ON_NurbsSurface::New();
    b2->GetNurbForm(*p2_nurb);
    b->NewFace(*p2_nurb);

    // Patch 3 of 6
    ON_BezierSurface *b3 = ON_CobbSphereFace(180, 0);
    ON_NurbsSurface *p3_nurb = ON_NurbsSurface::New();
    b3->GetNurbForm(*p3_nurb);
    b->NewFace(*p3_nurb);

    // Patch 4 of 6
    ON_BezierSurface *b4 = ON_CobbSphereFace(270, 0);
    ON_NurbsSurface *p4_nurb = ON_NurbsSurface::New();
    b4->GetNurbForm(*p4_nurb);
    b->NewFace(*p4_nurb);

    // Patch 5 of 6
    ON_BezierSurface *b5 = ON_CobbSphereFace(90, 90);
    ON_NurbsSurface *p5_nurb = ON_NurbsSurface::New();
    b5->GetNurbForm(*p5_nurb);
    b->NewFace(*p5_nurb);

    // Patch 6 of 6
    ON_BezierSurface *b6 = ON_CobbSphereFace(90, 270);
    ON_NurbsSurface *p6_nurb = ON_NurbsSurface::New();
    b6->GetNurbForm(*p6_nurb);
    b->NewFace(*p6_nurb);


    b->Standardize();
    b->Compact();

    return b;
}