Skip to content
  • Home
  • Work
  • About
  • Blog
  • Contact

Touch gestures construction - Constraining angles

John Goldsmith's profile image

John Goldsmith

17 August 2010
  • ShapeSheet

Constraining-Angles

In this second post on the Touch Gesture shapes construction I thought I’d look at a method for constraining the angle of a shape…

Default behaviour when you drag the rotation handle (blue circle in the above image) is for the shape to rotate with sub-degree accuracy. Often the angle will snap to various points such as the grid, shape geometry and extensions depending on what you have set in your Snap and Glue settings (2007 – Tools / Snap and Glue or 2010 - View / Visual Aids / Snap and Glue).

If, however, you want to constrain the angle to a particular step value then you can use the following formula:

Constrained-Angle-Formula

The formula uses three functions:- CEILING, ANG360 and SETATREFEXPR and I’ll look at what each of these do now.

  • SETATREFEXPR – The role of this function is to receive the incoming value, and make use of it rather than the cell formula being overwritten as it changes. If you watch the ShapeSheet, you can see the value (0 deg) changing as you rotate the shape.
  • ANG360 – This function normalises the angle to fall between 0 and 360 degrees.
  • CEILING – Finally, the CEILING function rounds the resulting value up to the next multiple (15 degrees in the above case) thereby giving you the constrained angle. So, for example, an angle of 14 degrees becomes 15 and an angle of 16 degrees becomes 30.

Of course there are lots of ways to tackle this problem and Chris Roth, over at VisGuy.com, has a post about an alternative method.

If you’re interested in the SETATREF family of functions you might want to have look at the Visio Insights blog.

Microsoft MVP Logo

John has been a Microsoft MVP, in the award categories of Visio and M365, since 2008.

Visio Blogs

  • Bill Morein (via Wayback Machine)
  • Chris Castillo (via Wayback Machine)
  • Chris Hopkins (via Wayback Machine)
  • David Parker
  • Eric Rockey
  • Jesse Phillips-Mead
  • John Marshall
  • Michel LAPLANE (FR)
  • Nikolay Belyh
  • Saveen Reddy (via Wayback Machine)
  • Visio Guy
  • Visio [Product] Blog
  • Visio Insights (via Wayback Machine)

Visio Resources

  • Developing Microsoft Visio Solutions
  • Visio Stencils at ShapeSource
  • Microsoft Visio YouTube Playlist
  • Visio (Product site)
  • Office 2010 Engineering
  • Visio 2016 SDK (Download)
  • Visio JavaScript API reference
  • VisioMVPs.org
Contact

visualSignals ltd
31 Riverview Grove
London, W4 3QL
United Kingdom

+44 (0) 208 078 9120

Around the Web

Copyright © visualSignals ltd 2025

Mastodon