1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-22 13:07:31 +02:00
Commit Graph

14 Commits

Author SHA1 Message Date
Werner Almesberger
a7105addcb Like rotations, shifts can now be accelerated by changing the mouse position.
- solidify/overlap.c (do_shift, shift): instead of passing an integer
  direction, pass a floating-point distance
- solidify/overlap.c (scroll_event): weight shifts as well. Closer to the
  circle means faster.
- solidify/style.h (DIST_STEPS): acceleration factor for shifts
2010-09-24 18:24:10 -03:00
Werner Almesberger
9c614db35a Bottom face was flipped in overlap.
- solidify/overlap.c (draw_map): flip x-axis of bottom face (and remove
  comment suggesting to flip the y axis. The x-axis is better, since this
  is often how things are scanned.)
2010-09-24 18:16:10 -03:00
Werner Almesberger
d4a5575599 Some simple optimizations increase drawing speed in overlap by 33%.
- solidify/overlap.c (overlap): added speed testing loop
- solidify/overlap.c (zmix): instead of floor/ceil, we just use
  floor/floor+1. With the ramp() change below, an 18% speed increase results
- solidify/overlap.c (ramp): after the above change, w0 and w1 can never be
  zero, so we don't have to test for this case
- solidify/array.h (get_bounded), solidify/array.c: inline get_bounded(),
  yielding a 13% speed increase
2010-09-24 17:56:55 -03:00
Werner Almesberger
2764155d15 Increase dynamic range of rotation and follow "far from center = faster"
paradigm.

- solidify/overlap.c (scroll_event): make weighting of rotation exponential,
  so we can both adjust precisely and spin rapidly. Also reverse weighting
  to rotate more quickly on the outside.
- solidify/style.h (SLOWEST_ROT, FASTEST_ROT): parameters for weighting of
  rotation
2010-09-24 17:28:48 -03:00
Werner Almesberger
7c24783cab More corrections to handling of the "user" matrix. Made controls more intuitive.
- solidify/overlap.c (rotate): don't reverse y shift either
- solidify/overlap.c (scroll_event): reverse rotation (since we've fixed
  the math of the coordinate transformation)
- solidify/overlap.c (scroll_event): reverse rotation if mouse is on the
  left side
- solidify/overlap.c (shift): reversing the direction in the "down"
  quadrant is systematic but quite confusing, so don't do it
2010-09-24 16:48:07 -03:00
Werner Almesberger
898970b3dd Instead of performing the tranformations stepwise for each point, pre-calculate
them once.

- solidify/matrix.h, solidify/matrix.c: 2D matrix operations
- solidify/Makefile (OBJS): added matrix.o
- solidify/face.h (struct matrix): moved to solidify/matrix.h
- solidify/overlap.c (point, merge_matrix, draw_map): precalculate a single
  vA+b transformation instead of stepwise transforming the vector inside
  the loop
- solidify/overlap.c (do_shift): now that the math is right (or at least
  better), reverse the shift
2010-09-24 16:42:36 -03:00
Werner Almesberger
f3e7c1ec73 Various coordinate transform corrections in overlap.c
- solidify/face.h (struct matrix), solidify/face.c (read_file): also record
  the face's center
- solidify/overlap.c (point): reference faces to the screen center
- solidify/overlap.c (point): use correct model coordinates for z0
  calculation
2010-09-24 03:46:32 -03:00
Werner Almesberger
85855ec5ac Overlapping now has an OSD, too.
- solidify/overlap.c (BORDER, sx, sy), solidify/style.h (OVERLAP_BORDER):
  moved and renamed
- solidify/overlap.c (r_center, scroll_event): moved center radius
  calculation to separate function
- solidify/overlap.c (draw_image): renamed to draw_map
- solidify/overlap.c (draw_image): draw an on-screen display (OSD)
- solidify/level.c (expose_event, overlap): propagate OSD on/off switch
- solidify/overlap.c (osd_proximity, scroll_event, motion_notify_event,
  overlap): enable OSD when approaching the center circle or a diagonal
- solidify/overlap.c (scroll_event): reversed the direction of rotation
2010-09-24 02:54:04 -03:00
Werner Almesberger
edb12b6e95 When leveling, the center circle is now shown when the pointer approaches it.
- solidify/Makefile: added util.o
- solidify/util.h, solidify/util.c (draw_circle): wrapper for gdk_draw_arc
- solidify/Makefile: added style.o
- solidify/style.h, solidify/style.c, solidify/solidify.c (main): GUI style
  parameters and items
- solidify/level.c (scroll_z. scroll_xy, scroll_event, level),
  solidify/overlap.c (scroll_event, overlap): renamed "da" to "darea", to
  avoid confusion with "da" for GdkDrawable in style.c
- solidify/level.c (r_center, scroll_event): moved center radius
  calculation to separate function
- solidify/level.c (draw_image): renamed to draw_map
- solidify/level.c (draw_image): draw an on-screen display (OSD)
- solidify/level.c (scroll_z, scroll_xy, expose_event, level): propagate
  OSD on/off switch
- solidify/level.c (scroll_event, motion_notify_event, level): enable OSD
  when approaching the center circle
2010-09-24 02:04:04 -03:00
Werner Almesberger
d49f349fa0 The top face can now be shifted.
- solidify/overlap.c (scroll_event): use center of canvas as center, not
  center of the top face
- solidify/overlap.c (do_shift, shift, scroll_event): added translation
  (shifting)
2010-09-24 01:11:57 -03:00
Werner Almesberger
525e1557ec Use two faces and show how they overlap (in progress)
- solidify/face.h (face_z0): calculate height of z0 plane
- solidify/level.c (draw_image): use face_z0 instead of open-coding the
  calculation
- solidify/overlap.c (draw_image, point): moved per-point processing from
  draw_image() to point()
- solidify/overlap.c (point): show differences between both faces
- solidify/solidify.c (usage, main): load both faces
- solidify/solidify.c (usage, main): accept distance between faces as third
  argument
2010-09-24 00:43:56 -03:00
Werner Almesberger
1fa23c574e Introduce a solid data type and use it, mainly in overlap()
- solidify/solid.h: definition of a solid made from two opposing faces
- solidify/overlap.h (overlap), solidify/overlap.c (draw_image,
  scroll_event, overlap): operate on solid instead of face
- solidify/overlap.c (sx, sy, draw_image, overlap): helper functions sx()
  and sy() to determine canvas size
- solidify/overlap.c (BORDER, sx, sy): added a border around the piece,
  to help with positioning
- solidify/solidify.c (clicked, gui_buttons, gui, main): use solid instead
  of faces
2010-09-23 23:41:35 -03:00
Werner Almesberger
b8bba1d3ab The GUI can now switch among operations.
- solidify/level.c (key_press_event, make_screen), solidify/solidify.c
  (key_press_event): moved "q" handler to solidify.c
- solidify/level.h (level), solidify/level.c (make_screen, level): removed
  root window initialization and merged remainder into "level"
- solidify/overlap.h (overlap), solidify/overlap.c (make_screen, overlap):
  removed root window initialization and merged remainder into "overlap"
- solidify/solidify.c (gui): initialize the root window
- solidify/solidify.c (gui, gui_buttons, clicked): added buttons to select
  operation
2010-09-23 23:18:46 -03:00
Werner Almesberger
cef7cd5e18 Added interactive 2D transformation (working towards overlapping)
- solidify/Makefile (OBJS): added overlap.o
- solidify/Makefile (CFLAGS): added -O9 to speed up rotation a little
- solidify/array.h, solidify/array.c (get_bounded): like get(), but returns
  UNDEF if the indices are outside the array
- solidify/face.h (struct face, struct matrix), solidify/face.c (read_file):
  added a 2D transformation matrix to "struct face"
- solidify/overlap.h, solidify/overlap.c: show a face with 2D transformation
2010-09-23 22:17:19 -03:00