Revision: 56695
          http://sourceforge.net/p/brlcad/code/56695
Author:   starseeker
Date:     2013-08-08 18:23:31 +0000 (Thu, 08 Aug 2013)
Log Message:
-----------
Add knots to curves

Modified Paths:
--------------
    brlcad/trunk/src/conv/step/ON_Brep.cpp

Modified: brlcad/trunk/src/conv/step/ON_Brep.cpp
===================================================================
--- brlcad/trunk/src/conv/step/ON_Brep.cpp      2013-08-08 18:07:51 UTC (rev 
56694)
+++ brlcad/trunk/src/conv/step/ON_Brep.cpp      2013-08-08 18:23:31 UTC (rev 
56695)
@@ -100,6 +100,33 @@
                control_pnts->AddNode(new EntityNode((SDAI_Application_instance 
*)step_cartesian));
        }
 }
+
+void
+ON_NurbsCurveKnots_to_Aggregates(ON_NurbsCurve *incrv, 
SdaiB_spline_curve_with_knots *step_crv)
+{
+       IntAggregate_ptr knot_multiplicities = step_crv->knot_multiplicities_();
+       RealAggregate_ptr knots = step_crv->knots_();
+       int i = 0; 
+       std::cout << "KnotCount: " << incrv->KnotCount() << "\n";
+       while (i < incrv->KnotCount()) {
+               int multiplicity_val = incrv->KnotMultiplicity(i);
+               /* Add knot */
+               RealNode *knot = new RealNode();
+               knot->value = incrv->Knot(i);
+               knots->AddNode(knot);
+               /* OpenNURBS and STEP have different notions of end knot 
conditions - 
+                * see http://wiki.mcneel.com/developer/onsuperfluousknot */
+               std::cout << "Multiplicity: " << multiplicity_val << " ";
+               if ((i == 0) || (i == (incrv->KnotCount() - 
incrv->KnotMultiplicity(0)))) multiplicity_val++;
+               std::cout << "Multiplicity after increment (" << i << "): " << 
multiplicity_val << "\n";
+               /* Set Multiplicity */
+               IntNode *multiplicity = new IntNode();
+               multiplicity->value = multiplicity_val;
+               knot_multiplicities->AddNode(multiplicity);
+               i += incrv->KnotMultiplicity(i);
+       }
+}
+
 #if 0
 void
 ON_RationalNurbsCurve_to_EntityAggregate(ON_NurbsCurve *incrv, 
SdaiRational_B_spline_curve *step_crv) {
@@ -177,10 +204,12 @@
                        if (n_curve->IsRational()) {
                                three_dimensional_curves.at(i) = 
registry->ObjCreate("RATIONAL_B_SPLINE_CURVE");
                        } else {
-                               three_dimensional_curves.at(i) = 
registry->ObjCreate("B_SPLINE_CURVE");
+                               three_dimensional_curves.at(i) = 
registry->ObjCreate("B_SPLINE_CURVE_WITH_KNOTS");
                                SdaiB_spline_curve *curr_curve = 
(SdaiB_spline_curve *)three_dimensional_curves.at(i);
                                curr_curve->degree_(n_curve->Degree());
                                ON_NurbsCurveCV_to_EntityAggregate(n_curve, 
curr_curve, registry, instance_list);
+                               SdaiB_spline_curve_with_knots *curve_knots = 
(SdaiB_spline_curve_with_knots *)three_dimensional_curves.at(i);
+                               ON_NurbsCurveKnots_to_Aggregates(n_curve, 
curve_knots);
                        }
 
                        instance_list->Append(three_dimensional_curves.at(i), 
completeSE);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to