tmpvar / livecad

live coding of 3d surfaces and objects
livecad.wtf
53 stars 2 forks source link

Some cylinders don't cut into other cylinders #69

Open realtaraharris opened 10 years ago

realtaraharris commented 10 years ago

This works:

var a = cylinder(2.0,4.48,3).rotate(45, 0, 0);
var b = cylinder(3,1);
var c = b.cut(a);

display(c);

but this doesn't:

var a = cylinder(2.0,4.49,3).rotate(45, 0, 0);
var b = cylinder(3,1);
var c = b.cut(a);

display(c);

This is breaking because the second example results in one or more b-spline curves, which aren't handled at the moment.

Look in net-oce/protocol/handlers/shape_display.h, lines 120-132:

    fprintf(stderr, "UNHANDLED CURVE TYPE: %i\n", curve_type);

    BRepAdaptor_Curve curve_adaptator (edge);
    GCPnts_UniformAbscissa discretizer;
    discretizer.Initialize (curve_adaptator, 0.5);

    fprintf(stderr, "discretization (other):");

    for (uint32_t i = 1; i <= discretizer.NbPoints (); i++) {
      gp_Pnt p = curve_adaptator.Value (discretizer.Parameter (i));
      fprintf(stderr, " (%f, %f, %f)", p.X(), p.Y(), p.Z());
    }
    fprintf(stderr, "\n");
realtaraharris commented 10 years ago

Notes:

NetOCE_Value is defined in net-oce/node_modules/net-oce-protocol/oce.proto

realtaraharris commented 10 years ago

http://opencascade.sourcearchive.com/documentation/6.3.0.dfsg.1-1/classAdaptor3d__Curve.html http://opencascade.sourcearchive.com/documentation/6.3.0.dfsg.1-1/classGeomAdaptor__Curve_a832bbb2ff8af9bcfb243c8ad5696675.html#a832bbb2ff8af9bcfb243c8ad5696675