Is tolerance for Vector3d.== documented anywhere?


Is tolerance for Vector3d.== documented anywhere? If not can I override the method?


I think not…
BUT SketchUp’s tolerance is 1/1000"…


As TIG says - it’s 1/1000", though I’m not sure if it’s mentioned anywhere. I did have a quick look in the API docs, as I wasn’t sure if it’s mentioned in a strafing comment somewhere. But I found none.

Do not under any circumstance override that method - it will break other extensions that rely on the original implementation. In fact, in order to get an extension submitted to the Extension Warehouse the extension must make no alterations to the Ruby core/stdlib classes/modules nor the SketchUp API.


What problem are you trying to solve? Maybe we can find a more direct solution? If the tolerance is not specified in the docs, SketchUp would have the freedom to change it at any time when they find reason to do so…


Thank you for replying to my question. I am writing a Ruby plugin to help design a track layout for Model trains. At some point it becomes necessary to determine if 2 tracks sections are attached which then becomes a test of whether 2 faces are “close enough”. I had thought that maybe I could make use of Sketchup’s tolerance criteria to determine “close enough”. For my purposes this is probably on the order of 1/32". Its simple enough to write a test but I was thinking of getting lazy.

I wonder if Sketchup’s immutable tolerance might cause problems given the difference in scale between architectural problems and small machine parts.


It does… :confused: With the increase in model for 3d printing there are more and more models that suffer from this when people model tiny details that get close to around or less than a couple of millimeters.


It would not be lazy, rather the opposite since you have to think about more edge cases when you dig into low level stuff. Let SketchUp do the tolerance. It’s automatically built-in into all numbers that are derived from the Length class, including Geom::Point3d and Geom::Vector3d.

Compare two points (one on each face) that should be identical when the faces touch or different when they don’t touch, and SketchUp’s Geom::Point3d.==(Geom::Point3d) method will give you the answer with considering floating point tolerance. You can get such two points by taking one from the first face and intersecting a line with the plane of the second face:

point1 = face1.vertices.first.position
line = [point1, face1.normal]
plane = face2.plane
point2 = Geom.intersect_line_plane(line, plane)
puts("close enough") if point1 == point2


An example is that you are building the layout (in Sketchup) and two tracks meet. The process is similar to building an actual track. Because of approximation errors the tracks do not meet precisely. If the error is less than 1/32" its ok. If its greater than 1/32" the design of the layout has to be changed. My guess is that if the criteria is .001", they will never meet.


Do you mean tolerance in the user interface, like the snapping in SketchUp’s inference engine?


What is needed is glue nodes that can snap together with directional limits (similar to the current planar limitations for glue_to components.)