Historical:Idea Brushing Polygon

From PanoTools.org Wiki
Revision as of 20:20, 20 May 2008 by Klaus (talk | contribs) (write-up with images)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Image masks for blending images are currently bitmap-based, but this information can be generated from polygon masks. Usually polygons are manipulated in grabbing the points or the faces. In hugin-ptx, relating to the Google SoC 2008 Masking in GUI project, the idea of brush strokes for easy mask generation has been put forward.

The following presents an idea on how brush stroke actions with the mouse can act on polygonal outlines. It is a rough description, not yet covering all special cases.

The main idea is that the start point and the initial direction of the brush stroke have an effect on how the polygon is modified. The click, hold and drag action starts away from any polygonal trace.

A rectangle framing the image shall be the start polygon.

Starting the brush stroke

Two different polygon examples are shown, with the brush stroke starting at the bottom in an upwards direction.
The dot at stroke start and the arrow may not always render correctly.

Error creating thumbnail: /bin/bash: line 1: rsvg-convert: command not found
Error creating thumbnail: /bin/bash: line 1: rsvg-convert: command not found

The mouse-down start point defines half-way boundaries. For each polygon this is a combination of that polygon being scaled (dashed line) and the perpendicular bisectors (dotted lines) between start point and polygon points.

Crossing the half-way mark

Error creating thumbnail: /bin/bash: line 1: rsvg-convert: command not found
Error creating thumbnail: /bin/bash: line 1: rsvg-convert: command not found

When the first of these half-way boundaries are crossed, the corresponding polygon is chosen, the half-way point defined, and also a trace, a part of the polygon outline, is selected as follows:

The start point and the half-way point define a direction. From the start point inside the angle range 30-60 degrees left one looks for a polygon point to act as trace endpoint (full blue circle). If there are several, one chooses the "best" as endpoint, which usually means the point nearest to the 45 degrees direction. If there is no point within that angle range but a polygon face, then a candidate endpoint (open circle) is placed on it at 45 degrees.

Then repeat for the angle range to the right.

There is a continuous polygon trace between two endpoints (blue), any segment of it connected to an endpoint is an endpoint segment. There may be intermediate points and intermediate segments (violet).

Possibly this trace should be highlighted at that point in the GUI.

Crossing into the polygon

Error creating thumbnail: /bin/bash: line 1: rsvg-convert: command not found
Error creating thumbnail: /bin/bash: line 1: rsvg-convert: command not found

When this highlighted trace is being crossed, any candidate endpoint is added as a new point to the polygon.

  • If one crosses an endpoint segment (blue line), a new point (red) is created and sticks to the pointer.
  • If one crosses an intermediate segment (violet line), this segment (red line plus two red points) sticks to the pointer.

Each of the violet polygon points between the red sticky middle element and a blue endpoint performs a scaled version of the pointer movement, with points nearer to an endpoint moving less.

This action is over when one releases the mouse button.

No action is taken is the mouse does not drag across the highlighted polygon trace.


Clicking into empty space deselects all.

Clicking and dragging on polygon points and lines yields standard response.

Dragging with modifyer down into empty space creates a new polygon.

Several polygons XOR, the resulting masks ORs with any input image bitmap mask.