## News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

## Constrain Control Handle to Circle

Started by Visio Guy, November 07, 2018, 09:11:18 PM

0 Members and 1 Guest are viewing this topic.

#### Visio Guy

How to do something very useful and rather obscure:

Constrain Control Handle to Circle
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

#### AndyW

Nice
Live life with an open mind

#### vojo

So you know what this is evidence of?

MS laziness!!!

With this, they could easily open the door to control point translation into 3D!!!
- use this to put control point function in a user or new controls3D cell
- No or significantly less cell constraints (this works with user cells today)...e.g. circle or ellipse easy enough
- Either transform the base function before pasting...or...let shape designers have more freedom for 3D

Just how tough is it to add rows to the shapesheet based on 2D rows, really!!!!!
(added bunch of other 3D cells)
Same for connection points.

BTW, very nice work on this...never even occurred to me to try something like this!!!!

#### vojo

if anybody wants constrain control handle to an ellipse, then

Assume ellipse is defined by width and height similar to circle.  For example, ellipse defined as  10mm X 6 mm

Then all is needed is to change the user.angle cell

From:   ATAN2(user.CHY-height*0.5, user.CHX-width*0.5)

To :      ATAN2((user.CHY-height*0.5)/height),(user.CHX-width*0.5)/width))

Enjoy

#### vojo

So to reveiew
- Visio guy constrained a control handle for a circle
- I extended to an ellipsis
- Here for an elliptical arc

Using the nice tutorial from visio guy, here is how to constrain and elliptical arc

Just need to change the controls.pntperimenter.y

From     setatref(user.chy,setatrefexpr(),true)+pnt(x,y)

To         setatref(user.chy,setatrefeval(bound(setatrefexpr(),0, false, height*0.5, height*1),true) + pnt(x,y)

The bound function essentially locks the controls to upper half of the ellipse.
In all cases - circle, ellipsis, elliptical arc - the rest of visio guys tutorial applies

I suspect you can do the same on controls.pntperimeter to constrain the x dimension
(maybe constrain a "slice of pie" in both X and Y axis).)

I would proffer that one can now constrain any simple curve.

#### vojo

shapes for reference

#### wapperdude

Uh, did I miss something?

Visio Guys article was about moving a control point on a shape.  It looks more like your control points allow the user to change the shape.  What you did is nice development, but, I'm confused--not what I was expecting.

Wapperdude

Visio 2019 Pro

#### vojo

The article was about constraining a control point in a circle no so much I have a given shape and want to move around the edge.  Control point around a circle gets complicated (dependence between X and Y...yet maintain the radius).

All I did was figure out how to extend to a ellipsis and how to bound for an elliptic arc.
(original article only worked on perfect circle).

What people choose to do with it is up them
(some sort of curve fitting around as given shape or user control of some curve creation).

I guess all I am saying is that I was impressed with myself on figuring out changes
- Modifying the angles (for ellipsis)...had to search and find a pretty obscure article about translating angles in an ellipsis
- Bound a control point in a Setatref statement (arc)....more experimentation with all the setat*** functions.

Apologies if this seems pedantic.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 278 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1144KB.