Difference between revisions of "OnCanvasSymmetryTool"

From Inkscape Wiki
Jump to navigation Jump to search
(GSoC Project On-Canvas Support for Creating and Modifying Wallpaper Symmetry Groups)
 
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
The On-Canvas Support for Creating and Modifying Wallpaper Symmetry Groups is based on the functionality currently available in the "Create Tiled Clones ..." dialog.
The On-Canvas Support for Creating and Modifying Wallpaper Symmetry Groups is based on the functionality currently available in the "Create Tiled Clones ..." dialog.


'''Primary focus:'''
== Description ==


Redesign parts of the Cloned Tiles User Interface.  In particular, I am interested in on-canvas control of the size, position, orientation and skew of the boundary of the base tile as well as on-canvas control of the number and “placement” of cloned tiles (by placement, I mean what is currently controlled by the row and column fields of the current Create Cloned Tiles dialog).
Redesign parts of the Cloned Tiles User Interface.  In particular, this project will focus on on-canvas control of the size, position, orientation and skew of the boundary of the base tile as well as on-canvas control of the number and “placement” of cloned tiles (placement refers to the attributes currently specified either by the row/column or the width/height fields in the current Create Cloned Tiles dialog).




'''Related blueprints:'''
== Related Blueprints ==


[https://blueprints.launchpad.net/inkscape/+spec/tiling-tool - Tiling Tool for Wallpaper, Radial and line tiling]
[https://blueprints.launchpad.net/inkscape/+spec/tiling-tool - Tiling Tool for Wallpaper, Radial and Line tiling]


[https://blueprints.launchpad.net/inkscape/+spec/symmetrical-drawing - Symmetrical Drawing]
[https://blueprints.launchpad.net/inkscape/+spec/symmetrical-drawing - Symmetrical Drawing]


'''Use Cases:'''
== Use Cases ==


1) Visualize the tiling pattern
UC 1) User has created one or more objects which they want to replicate using a group of symmetry relationships (rotation, reflection, translation or glide).  The user must choose a symmetry group or create their own set of transformation rules.


Markers to show operations at edges or corners - will this conflict with transformation markers?
[[Media:WallpaperTransformations.png | Transformation base tiles for wallpaper groups]]
Edges of different styles - will this conflict with selection recetangle?
Shape of base tile, shape of cloned tiles


2) Create a base tile based on a symmetry group
In order to choose the symmetry relationships that will produce the desired effect, the user must understand how clones of the base tile will be transformed.  For example, if the user selects a symmetry type of CMM, they will want to know at a general level that the  tile will be reflected in two orthogonal directions and rotated 180 degrees in a diagonal direction.  At a more specific level, they will want to know across what lines the pattern will be reflected and what is the pivot point for the rotation.


Drag a rectangle around one or more items. Based on symmetry group specified in toolbar, use bounding box to
An on-canvas visualization of the base tile and of the tiling pattern is proposed.
create a default base tile - will create a group and put base tile inkscape attributes on group
If already a base tile? Just select and show the current base tile, do not create a new one


3) Create clones from a base tile using standard symmetry groups
* Draw the outline of the base tile using different line styles and markings to indicate the transformation operations.
* Draw a grid showing how the base tile will be transformed to cover the plane.  Cloned tiles will appear in the cells of the grid.


'''Frieze'''
The following picture shows what this might look like:
Select a base tile and ?? click on a path. Base tile is repeated along path using symmetry properties
Clipped at beginning and ends of path like text - if path extended? extend pattern
clone objects reference base tile and have an offset from base to indicate number of repeats.
Alternatively, select a base tile and click to create first clone, drag "left" or "right" to create additional clones based
symmetry pattern


'''Rosette'''
[[File:cmmExample.png]]


'''Wallpaper'''
UC 2) The user has created several tiled clones from a base object and now wishes to modify the way the cloned objects are positioned.  For example, they want to have more space between the copies.


4) Modify base tile size, posiiton, orientation, skew, angle and update cloned tiles
On-canvas transformation of the base tile outline is proposed.  The existing transformation tool will be used and applied to the bounding box of the base tile.


5) Change symmetry group of base tile (maybe even allow non planar tilings) and update cloned tiles
The following picture shows what this might look like:


6) Apply size and shift deltas to cloned tiles
[[File:transformExample.png]]


7) Work with existing SVG documents.
 
== Implementation Considerations ==
 
For each proposed feature, three things must be considered:
 
# The user interaction
# How the SVG markup is affected
# The mathematics of the operation and coding implications
 
UC 1) '''Grid for symmetry groups'''
* ''User interaction''
** User enables grid display through menu or keyboard accelerator
** Grid displayed changes depending on which base tile or cloned tile is selected.  If the user selects an object that is a clone (svg:use that references a base tile) or the selected object or one of its parents is a base tile (navigate up the hierarchy until a base tile is found or reach the top of the document), then the tiling pattern will be displayed.
** If multiple objects are selected and they map to more than one base tile, no grid outline will be shown.
* ''SVG markup''
** Requires the base tile markup to have the following information:
*** inkscape:tile-x0, inkscape:tile-y0, inkscape:tile-w, inkscape:tile-h (These items are already added to the SVG markup as part of the ''Create Tiled Clones...'' dialog.)
*** inkscape:tile-type (This attribute is new for this feature.  It stores the wallpaper symmetry group type - P1, P2, CMM etc)
* ''Math and Code''
** For each symmetry group type, determine the shape, size and position of the base tile.
** This information is documented in the code.  See symmetry-tool.cpp.  It is based on the algorithm currently used in the ''Create Tiled Clones...'' dialog.
 
UC 2) '''Transformation of Base Tile'''
* ''User interaction''
** Select a clone and navigate to the base tile object (Select Original)
** Go to the Select and Transform objects tool (could also use the Transform dialog)
** The selection boundary displayed on canvas for the base tile object is not the bounding box of the child elements.  Instead it is the bounding box of the base tile.  The usual transformation handles are displayed.
 
* ''SVG markup''
** In order to propogate changes from the base tile to the cloned tiles, it will be necessary to know how the cloned tiles relate to the base tile.  For rectangular symmetry groups this could be done with a row and column label, however, this does not translate well to non-rectangular symmetry groups such as hexagonal groups.  An alternative approach is to use a label based on transformations from the base as shown in the following figure.
 
[[File: Rowcolumn.png|400px]]
 
**  This does not produce a unique labelling but that is not important.
** The label will need to be saved on the cloned tile (e.g. inkscape:tiled-clone-pos="1 3 1 3")
 
* ''Math and Code''
** Currently, if a group object is selected, the bounding box displayed is the bounding box that contains all children.  In the case where the group is a base tile (indicated by the presence of the inkscape:tile-type attribute) this behaviour will be changed to show the bounding box of the base tile.
** Transformations made will be applied to the base tile (inkscape:tile-w, inkscape:tile-h attributes etc) not to the group transform attribute.
** The transform attribute of all clones will be updated based on the changes to the base tile.
 
* ''Issues''
** There are two possible behaviours when transforming the base tile. The base tile boundaries can change (e.g. scale, skew, translate, rotate) independant of the child objects.  This is useful for example if you want to space the clones farther apart.  You would scale the base tile leaving the child objects unchanged.  You could then enter the group and change the position of the child objects relative to the base tile.  Alternatively, you may wish to enlarge the whole pattern - this requires enlarging the base tile as well as enlarging the child objects.  How will the user trigger these two very different modes?  Will there be some kind of ''lock'' mechanism?
** There is an assumption that the base tile will be a group.  Having a group object is very useful because it allows the user to add and remove objects from the base tile and decouples the base tile data from the pattern object data.  We could automatically create a group for the user and ensure that all base tiles have a group as their root object.  However, this is not how the current ''Create Tiled Clones...'' dialog works and it is not a requirement imposed by SVG.
** Not all transformations are allowed for a given symmetry group so some transformation operations would need to be disabled - I don't think this is currently supported by the Transformation Tool.

Latest revision as of 00:55, 7 June 2012

The On-Canvas Support for Creating and Modifying Wallpaper Symmetry Groups is based on the functionality currently available in the "Create Tiled Clones ..." dialog.

Description

Redesign parts of the Cloned Tiles User Interface. In particular, this project will focus on on-canvas control of the size, position, orientation and skew of the boundary of the base tile as well as on-canvas control of the number and “placement” of cloned tiles (placement refers to the attributes currently specified either by the row/column or the width/height fields in the current Create Cloned Tiles dialog).


Related Blueprints

- Tiling Tool for Wallpaper, Radial and Line tiling

- Symmetrical Drawing

Use Cases

UC 1) User has created one or more objects which they want to replicate using a group of symmetry relationships (rotation, reflection, translation or glide). The user must choose a symmetry group or create their own set of transformation rules.

Transformation base tiles for wallpaper groups

In order to choose the symmetry relationships that will produce the desired effect, the user must understand how clones of the base tile will be transformed. For example, if the user selects a symmetry type of CMM, they will want to know at a general level that the tile will be reflected in two orthogonal directions and rotated 180 degrees in a diagonal direction. At a more specific level, they will want to know across what lines the pattern will be reflected and what is the pivot point for the rotation.

An on-canvas visualization of the base tile and of the tiling pattern is proposed.

  • Draw the outline of the base tile using different line styles and markings to indicate the transformation operations.
  • Draw a grid showing how the base tile will be transformed to cover the plane. Cloned tiles will appear in the cells of the grid.

The following picture shows what this might look like:

CmmExample.png

UC 2) The user has created several tiled clones from a base object and now wishes to modify the way the cloned objects are positioned. For example, they want to have more space between the copies.

On-canvas transformation of the base tile outline is proposed. The existing transformation tool will be used and applied to the bounding box of the base tile.

The following picture shows what this might look like:

TransformExample.png


Implementation Considerations

For each proposed feature, three things must be considered:

  1. The user interaction
  2. How the SVG markup is affected
  3. The mathematics of the operation and coding implications

UC 1) Grid for symmetry groups

  • User interaction
    • User enables grid display through menu or keyboard accelerator
    • Grid displayed changes depending on which base tile or cloned tile is selected. If the user selects an object that is a clone (svg:use that references a base tile) or the selected object or one of its parents is a base tile (navigate up the hierarchy until a base tile is found or reach the top of the document), then the tiling pattern will be displayed.
    • If multiple objects are selected and they map to more than one base tile, no grid outline will be shown.
  • SVG markup
    • Requires the base tile markup to have the following information:
      • inkscape:tile-x0, inkscape:tile-y0, inkscape:tile-w, inkscape:tile-h (These items are already added to the SVG markup as part of the Create Tiled Clones... dialog.)
      • inkscape:tile-type (This attribute is new for this feature. It stores the wallpaper symmetry group type - P1, P2, CMM etc)
  • Math and Code
    • For each symmetry group type, determine the shape, size and position of the base tile.
    • This information is documented in the code. See symmetry-tool.cpp. It is based on the algorithm currently used in the Create Tiled Clones... dialog.

UC 2) Transformation of Base Tile

  • User interaction
    • Select a clone and navigate to the base tile object (Select Original)
    • Go to the Select and Transform objects tool (could also use the Transform dialog)
    • The selection boundary displayed on canvas for the base tile object is not the bounding box of the child elements. Instead it is the bounding box of the base tile. The usual transformation handles are displayed.
  • SVG markup
    • In order to propogate changes from the base tile to the cloned tiles, it will be necessary to know how the cloned tiles relate to the base tile. For rectangular symmetry groups this could be done with a row and column label, however, this does not translate well to non-rectangular symmetry groups such as hexagonal groups. An alternative approach is to use a label based on transformations from the base as shown in the following figure.

Rowcolumn.png

    • This does not produce a unique labelling but that is not important.
    • The label will need to be saved on the cloned tile (e.g. inkscape:tiled-clone-pos="1 3 1 3")
  • Math and Code
    • Currently, if a group object is selected, the bounding box displayed is the bounding box that contains all children. In the case where the group is a base tile (indicated by the presence of the inkscape:tile-type attribute) this behaviour will be changed to show the bounding box of the base tile.
    • Transformations made will be applied to the base tile (inkscape:tile-w, inkscape:tile-h attributes etc) not to the group transform attribute.
    • The transform attribute of all clones will be updated based on the changes to the base tile.
  • Issues
    • There are two possible behaviours when transforming the base tile. The base tile boundaries can change (e.g. scale, skew, translate, rotate) independant of the child objects. This is useful for example if you want to space the clones farther apart. You would scale the base tile leaving the child objects unchanged. You could then enter the group and change the position of the child objects relative to the base tile. Alternatively, you may wish to enlarge the whole pattern - this requires enlarging the base tile as well as enlarging the child objects. How will the user trigger these two very different modes? Will there be some kind of lock mechanism?
    • There is an assumption that the base tile will be a group. Having a group object is very useful because it allows the user to add and remove objects from the base tile and decouples the base tile data from the pattern object data. We could automatically create a group for the user and ensure that all base tiles have a group as their root object. However, this is not how the current Create Tiled Clones... dialog works and it is not a requirement imposed by SVG.
    • Not all transformations are allowed for a given symmetry group so some transformation operations would need to be disabled - I don't think this is currently supported by the Transformation Tool.