• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

5. Transforming the Coordinate System > Technique: Scaling Around a Center Poin...

Technique: Scaling Around a Center Point

While it’s possible to rotate around a point other than the origin, there is no corresponding capability to scale around a point. You can, however, make concentric symbols with a simple series of transformations. To scale an object by a given factor around a center point, do this:

translate(-centerX*(factor-1), -centerY*(factor-1))

You may also want to divide the stroke-width by the scaling factor so the outline stays the same width while the object becomes larger. Example 5-11 draws the set of concentric rectangles shown in Figure 5-19.[6]

Example 5-11. Scaling around a center point
<!-- center of scaling -->
<circle cx="50" cy="50" r="2" style="fill: black;"/>

<!-- non-scaled rectangle -->
<g id="box" style="stroke: black; fill: none;">
    <rect x="35" y="40" width="30" height="20"/>

<use xlink:href="/getfile?safari4=true&item=/images/0596002238/assets/#box" transform="translate(-50,-50) scale(2)"
    style="stroke-width: 0.5;"/>
<use xlink:href="/getfile?safari4=true&item=/images/0596002238/assets/#box" transform="translate(-75,-75) scale(2.5)"
    style="stroke-width: 0.4;"/>
<use xlink:href="/getfile?safari4=true&item=/images/0596002238/assets/#box" transform="translate(-100,-100) scale(3)"
    style="stroke-width: 0.33;"/>



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint