-
Notifications
You must be signed in to change notification settings - Fork 4
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
AN IDEA! #1
Comments
Great Idea! I actually originally wanted to make the ball sticky and stick to a certain side to achieve a more accurate reading, but that was alas beyond my current abilities... This is even harder I believe, especially to find where the line should be drawn. I suggested to @simoncozens if his Calipers tool could work around an entire /o and I think it was a similar issue https://twitter.com/w__h_/status/710460919151763456 |
RIGHT THE OPPOSING SIDE.. and the opposite path too. Lets explore that for a second. Lets do it for an O(two paths) and an S(one path). var smallestDistance;
var lines = [];
var glyph = {
name: "S",
paths: [ ],
};
foreach path, pathIndex in glyphFromRobofont {
glyph.paths.push({
index: pathIndex,
name: path.name,
instances: []
});
foreach instance, instanceIndex in path.instances {
glyph.paths[pathIndex].push({
index: instanceIndex,
name: instance.name,
distanceFromCursor: distance(instance.location, cursor.location)
}
foreach instance, instanceIndex in glyph.paths.instances {
foreach instance2, instanceIndex2 in glyph.paths.instances {
if (line(instance, cursor.location, instance2)){
line.push({
instance1: instance,
cusor: cursor,
instance2: instance2,
distance: distance(instance.location, cursor.location, instance2.location)
});
}
}
}
}
smallestDistance = smallestInList(lines, distance);
// This is the line that is the shortest length that intersects any two points on all paths and your cursor
style(smallestDistance); Before I wrote that solution I considered an alternative... I don't think this conversation is helpfull in the case of a strait line but maybe it is useful for Gauge tool. How do we find the opposite path: This will only happen with two or more paths so we don't need to explore S. Why not just calculate distances for all paths? BUT then there is the possibility of having overlapped measurements.. but that probably wouldn't be the end of the world. How do we find the opposing side: Well you could calculate all instance of a path. You could then display those instances in a list with the instance id and distances from that instances' location and the cursor. Once you have that all you need to do is divide that list in half and you should have a range that doesn't include the other side of a glyph. |
Right! but if you put the cursor within the body of the "n" it would draw a line to the other side of the stem. If your cursor was within the aperture of the "n" wouldn't you expect it to draw the line within that aperture? |
if you wanted to get super specific you could add an if that doesn't draw any line if the cursor is actually on a path. |
Right! That's the same idea but using the heart line instead of the cursor. |
Do you know what though, this would be a GREAT tool for easily measuring the width of diagonal stems, I don't know the right equations to find the two closest point between two segments. |
Glyphs has Objective C functions you can use to do this. I don't know if they're exposed to Python. Look in GSGeometrieHelper.h |
Instead of having a fixed oval as the form to determine stroke width why not calculate the shortest straight line between any two points of your paths and the cursor. That way it could live calculate the CURRENT stroke width and you could use the tool to determine transitions of any stroke width? (not just monolinear ones)
UPDATE
not monolinear per say.. more like taking tool rotation into consideration. After playing with it more I realize my goal and this extensions goal isn't quite the same so perhaps this isn't a great use of an "issue". ANYWAYS, smart extension.
The text was updated successfully, but these errors were encountered: