Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
skFitSpline and bSplineCurve .controlPoints
hervé_pipon
Member Posts: 60 ✭✭
Hello,
I draw a spline on sketch1:
test: same with code formatting
I use a Feature to print information :
export const main = defineFeature(function(context is Context, id is Id, definition is map)
I draw a spline on sketch1:
skFitSpline(sketch1, "spline1", {
"points" : [
vector( 0 , 0) * centimeter,
vector( 100, 100) * centimeter
],
"startDerivative" : vector(150 , 0) * centimeter,
"endDerivative" : vector(0 , 150) * centimeter,
});
test: same with code formatting
<div> skFitSpline(sketch1, "spline1", {</div><div> "points" : [</div><div> vector( 0 , 0) * centimeter,</div><div> vector( 100, 100) * centimeter</div><div> ],</div><div> "startDerivative" : vector(150 , 0) * centimeter,</div><div> "endDerivative" : vector(0 , 150) * centimeter,</div><div> });</div>
I use a Feature to print information :
export const main = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Spline", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 }
definition.selectedEdge is Query;
}
{
var sketchPlane = evOwnerSketchPlane(context, { "entity" : definition.selectedEdge });
var data = evCurveDefinition(context, {
"edge" : qEntityFilter(definition.selectedEdge, EntityType.EDGE),
"returnBSplinesAsOther":false
});
var P1 = worldToPlane(sketchPlane, data.controlPoints [0]);
var P2 = worldToPlane(sketchPlane, data.controlPoints [1]);
var P3 = worldToPlane(sketchPlane, data.controlPoints [2]);
var P4 = worldToPlane(sketchPlane, data.controlPoints [3]);
println(P1);
println(P2);
println(P3);
println(P4);
...
when I click on this spline it prints:
when I click on this spline it prints:
(0 meter, 0 meter)
(0.5340613126754761 meter, -1.8922261703604592e-31 meter)
(0.9994866847991959 meter, 0.5380544066429138 meter)
(1 meter, 1 meter)
we can approximate
we can approximate
(0.5340613126754761 meter, -1.8922261703604592e-31 meter) ~~ (0.534,0)
(0.9994866847991959 meter, 0.5380544066429138 meter) ~~ (1, 0.538)
So we have :
My question is:
Why 0.534 or 0.538, and not 0.5 ?
If someone could explain me ?
So we have :
P1 => vector( 0 , 0) * centimeter,
P4 => vector( 100, 100) * centimeter
but if I correctly understand
P2 has to be : P1 + startDerivative / 3 => (0.5, 0) and in fact is (0.534,0)
but if I correctly understand
P2 has to be : P1 + startDerivative / 3 => (0.5, 0) and in fact is (0.534,0)
P3 has to be : P4 - endDerivative / 3 => (1 , 0.5) and in fact is (1, 0.538)
My question is:
Why 0.534 or 0.538, and not 0.5 ?
If someone could explain me ?
Tagged:
0