-
Notifications
You must be signed in to change notification settings - Fork 264
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
time to compute combineUnion #477
Comments
Hello, no it's nothing you are doing wrong. Currently it is a brute force naïve O-squared implementation. I have been working on a solution to this for a while, but I do not have release-ready results yet. If you're brave enough to try, see the https://github.com/microsoft/maker.js/tree/combine-sweep-expand-wip branch. The workaround you can do now is to cache as much as possible. Perhaps offline you can run kerning pairs of characters to see which overlap and which do not, and grab pre-computed characters instead of a "live" union. Hopefully that makes sense. |
Can we not make the complete process GPU based it will increase the time to
process.
…On Fri, Dec 4, 2020, 06:31 Dan Marshall ***@***.***> wrote:
Hello, no it's nothing you are doing wrong. Currently it is a brute force
naïve O-squared implementation. I have been working on a solution to this
for a while, but I do not have release-ready results yet. If you're brave
enough to try, see the
https://github.com/microsoft/maker.js/tree/combine-sweep-expand-wip
branch.
The workaround you can do now is to cache as much as possible. Perhaps
offline you can run kerning pairs of characters to see which overlap and
which do not, and grab pre-computed characters instead of a "live" union.
Hopefully that makes sense.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#477 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACKGLGD7FFKT57QAM6CN2OTSTAYH7ANCNFSM4UMSCRZQ>
.
|
Sharing this in case someone else runs into this. When you don't know if the font requires combining, the for ( let i = 1; i < size; i++ ) {
let extend1 = makerjs.measure.modelExtents( { models: combinedModels } );
let extend2 = makerjs.measure.modelExtents( models[ i ] );
// When the model extension is not an object, assume it is a space.
// It also assumes that the first character is not a space.
// So before this function, the text should have been trimmed.
if ( ! isObject( extend2 ) ) {
continue;
}
// Combining is very slow, so first check if the measurements are overlapping.
// If they don't overlap, we are guaranteed that we don't have to combine.
if ( makerjs.measure.isMeasurementOverlapping( extend1, extend2 ) ) {
makerjs.model.combineUnion( { models: combinedModels }, models[i] )
}
combinedModels = {
...combinedModels,
[ i ]: models[ i ],
}
} This cool trick also exists in the some of the code of Maker.JS 😁 |
@atimmer this might work for some of the font, which is actually good , i will try this in my code 🤞 |
we are building a too for a Vinyl printing shop and we need to optmize a lot of text in a model.
few of our font have complicated geometry like below , and the text overlap, we are using "combineUnionfor" for every letter in the text , but its taking too long to get an output ,
so the Question is does combineUnion take this long to compute the path (very long about 20-30 seconds for the below code which can be tested in playgraound )
here is my code
am i doing something wrong?
The text was updated successfully, but these errors were encountered: