-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q: PolyBezier surface calculation #217
Comments
It probably also depends on what you intend to do: are you trying to find individual points on the surface, are you trying to approximate the surface as a mesh for rendering purposes, etc. |
In fact I need to calculate the value itself for printing purposes, then I can infer material usage, costs etc. |
But what is "the value"? A surface has infinitely many values, so what are you actually trying to find? |
It is the fill of the PolyBezier. |
Currently I am using pixel counting |
Are you implementing your own graphics (sub)system? Because most programming languages already come with shape fill solutions =) |
no, I am not.
Please elaborate. I am using plain web vanilla js. |
The web stack has SVG: creating a But of course the best solution will require knowing more about what you're actually working on and how you're implementing that atm. |
I am building an app that prints letters using CNC Thanks for the help so far! |
I think we're running into term confusion here: you're not talking about surfaces in relation to Bezier curves, which are a property of 3D curve sets. You're talking about actual physical material surfaces, so: be aware of the fact that the same term in different context can mean a wildly different thing. Don't talk about "bezier surfaces" when you're not talking about 3D surface math, you're just going to confuse math folks =) So: you looking for a way to efficiently run a CnC bit along a path that will clear the interior of a closed shape. You absolutely don't want to use pixel counting for that, you want to know the dimensions of the CnC bit so that you can trace a path for that bit with minimal overlap. For that, you can just inset the polybezier: if your bit is Xmm, and you want a 10% cut overlap, and you have an initial outline, your first pass will be "that outline, offset by Xmm on the inside", and that's the first cutting pass. Then every subsequent pass is another (X*0.9mm) internal offset. (i.e. take advantage of the fact that you have parallel contours) |
This is correct most of the time and means that to calculate the fill amount w/o pixel counting I need to split all the contours into segments by the x axis for integral calculation. Can be done but I hoped to avoid it with some clever math. Thanks for your response and great work |
If I do that would you be interested in a contribution exposing a method on PolyBezier? If so please provide a name for it ;) |
it depends a little on what it does, specifically, but something like |
I am looking into calculating the surface of a given PolyBezier.
I read a bit of the great guide https://pomax.github.io/bezierinfo.
At the beginning I thought of using integral calculus to do that.
The challenge of this approach is correctly subtracting the curves from each other, i.e splitting into x-axis segments. This becomes much more complex when the outline is self intersecting.
Then I thought of using calculus theory instead of practice:
bez.length() * d * 2
should yield the correct result.This is much simpler but still doesn't manage to include self intersecting outline cases.
Suggestions would be appreciated, thanks!
The text was updated successfully, but these errors were encountered: