Aerilius / sketchup-console-plus

A better Ruby Console and IDE for integrated development in SketchUp.
MIT License
42 stars 17 forks source link

Visualized Normals doesn't scale with viewport #11

Closed thomthom closed 7 years ago

thomthom commented 7 years ago

It appear that normals have a pixel model-space size. Would be nice if they where relative to screen size.

image

Aerilius commented 7 years ago

A vector has a length and direction. If we want to represent both accurately, need to use model space (and it shows big if close and small if far away).

But often the user is more interested in the direction (especially with normals), and normals have always a very short length which makes this issue a problem.

thomthom commented 7 years ago

I had not thought of that - vectors in model space.

Internally in SketchUp we have the concept of Unit Vector and Vectors (CUnitVector and CVector3d). But in the Ruby API there is no such distinction.

We do have .unitvector? (http://ruby.sketchup.com/Geom/Vector3d.html#unitvector%3F-instance_method)

This will return true for all vectors with a total length of 1.0. We could use that, drawing unit vectors with fixed size in the viewport. Then for non-unit-vectors one could assume it's in modelspace.

It will have the edge case of whenever you have a model space vector that happen to be length of one it'll be treated as unit vector. But I think that might still cover more of the common uses.

Aerilius commented 7 years ago

Added branch feature-highlight_unitvector

Aerilius commented 7 years ago

Merged branch feature-highlight_unitvector in commit b03116f7004716a39a95c9036f0ddfe5d29c5894