Scalemarkers numbered #1131

Merged
merged 6 commits into from Jan 8, 2015

Conversation

Projects
None yet
2 participants
@TDeagan
Contributor

TDeagan commented Jan 2, 2015

This pull request represents a set of changes to add numbered scale markers as discussed at #1116

The scale marking is user select-able using a menu item in the View menu.

The markers change proportionally based on the length of the axes using a log function to provide units in powers of ten at all zoom levels.

The markers currently in code provide a single arm to one side of the axis, additional arms are present but commented in the code.

The numbers are generated by GL_LINES, GL_LINE_STRIPs or GL_LINE_LOOPs as appropriate. Their sizing remains consistent regardless of scale.

screen shots:
image
image

Here are some downsides (though not necessarily issues, just artifacts):

when the model is flush to the axis, it gets harder to read:
image

When you aren't in the 'upright' orientation, the characters (like any .scad based text) are reversed (seen from below):
image

The tics are reliant on the axes' length. So when they give out at some zoom level, so do the scale markings:
image

TDeagan added some commits Dec 27, 2014

Add optional menu driven scaling tics to the large axes
Tim Deagan 12/26/2014

While add-on rulers can be extremely useful, there are many times that a quick scaling marker would be handy. This feature generates tics every 10 units, driven off the log10 of the l variable defining axes length.  As you zoom in or out, the tics automatically re-scale themselves.  Every tenth tic is slightly larger.  A menu item is added to the view menu to enable or disable the feature.

I experimented with menu driven scaling (.01, .1, 1, 10, etc.), but using small increments when zoomed out brought the app to it's knees.  Adding a visual indicator of the current scaling might be nice, but I'm nto sure where to put it (possibly below the small axes,) since it changes as zooming and would clutter the console.

 Changes to be committed:
	new file:   images/scalemarkers.png
	modified:   openscad.qrc
	modified:   src/GLView.cc
	modified:   src/GLView.h
	modified:   src/MainWindow.h
	modified:   src/MainWindow.ui
	modified:   src/QGLView.h
	modified:   src/mainwin.cc
Merge remote-tracking branch 'upstream/master' into scalemarkers
merging the upstream/master branch into my working branch prior to syncing with my fork
12/26/2014 22:07 CST tim deagan
Addition of function to generate scale maker numeric values on large …
…axes.

	modified:   src/GLView.cc

The added function takes the length of the axis (l), the currrent position on the axis (i) and the size of the divisions between i and uses a variety of arrays to decode the characters of the position into GL_LINES, GL_LINE_STRIPs, GL_LINE_LOOPs as appropriate.  The various orientations required by the axis are handled by abstracting the line vertex sequences into arrays (set per axis.)
Addition of header to support function to print scale marker position…
… values on large axes.

	modified:   src/GLView.h
Fix layout of number 6 character & add comments
The layout of the array that drives the 6 char was wrong.  Additional
commenting added
Swap out spaces for tabs
	modified:   src/GLView.h
	modified:   src/MainWindow.h
	modified:   src/QGLView.h
	modified:   src/mainwin.cc

QtCreator ignores the prefs and will only put in spaces instead of tabs.  These are manual fixes in Notepad++ to try and keep the indents in the standard mode.

kintel added a commit that referenced this pull request Jan 8, 2015

@kintel kintel merged commit c8097c4 into openscad:master Jan 8, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@kintel

This comment has been minimized.

Show comment
Hide comment
@kintel

kintel Jan 8, 2015

Member

I already merged this, but found a small bug:
If your design is not centered in the origin and you zoom into it, the scale markers eventually disappear since you assume that the center of focus is the origin.

Member

kintel commented Jan 8, 2015

I already merged this, but found a small bug:
If your design is not centered in the origin and you zoom into it, the scale markers eventually disappear since you assume that the center of focus is the origin.

@TDeagan

This comment has been minimized.

Show comment
Hide comment
@TDeagan

TDeagan Jan 8, 2015

Contributor

I already merged this, but found a small bug:
If your design is not centered in the origin and you zoom into it, the scale markers eventually disappear since you assume that the center of focus is the origin.

Frak! I thought sure I tested that. I must have gotten complacent thinking I was mimicking the GLView::showAxes setup. Basing my scaling entirely on cam.projection == Camera::PERSPECTIVE ? cam.viewer_distance : cam.height; is the problem.

Sigh, there goes my fantasy of faking an understanding of how the camera stuff programmatically works. Sorry about that!!! I'l dig in and get a sufficient understanding.

Contributor

TDeagan commented Jan 8, 2015

I already merged this, but found a small bug:
If your design is not centered in the origin and you zoom into it, the scale markers eventually disappear since you assume that the center of focus is the origin.

Frak! I thought sure I tested that. I must have gotten complacent thinking I was mimicking the GLView::showAxes setup. Basing my scaling entirely on cam.projection == Camera::PERSPECTIVE ? cam.viewer_distance : cam.height; is the problem.

Sigh, there goes my fantasy of faking an understanding of how the camera stuff programmatically works. Sorry about that!!! I'l dig in and get a sufficient understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment