Author Topic: Constrain Control Handle to Circle  (Read 3090 times)

0 Members and 1 Guest are viewing this topic.

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1698
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Constrain Control Handle to Circle
« on: November 07, 2018, 04:11:18 PM »
How to do something very useful and rather obscure:

Constrain Control Handle to Circle
« Last Edit: November 07, 2018, 06:09:59 PM by Visio Guy »
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

  • Sr. Member
  • ****
  • Posts: 319
    • PC Mimic Diagram
Re: Constrain Control Handle to Circle
« Reply #1 on: November 08, 2018, 09:53:32 AM »
Nice  :)
Live life with an open mind

vojo

  • Hero Member
  • *****
  • Posts: 1381
Re: Constrain Control Handle to Circle
« Reply #2 on: December 05, 2018, 03:27:55 PM »
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

  • Hero Member
  • *****
  • Posts: 1381
Re: Constrain Control Handle to ellipse
« Reply #3 on: January 29, 2020, 11:12:30 PM »
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

  • Hero Member
  • *****
  • Posts: 1381
Re: Constrain Control Handle to Circle, ellispsis, ellipsis arc
« Reply #4 on: February 09, 2020, 03:43:29 PM »
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

  • Hero Member
  • *****
  • Posts: 1381
Re: Constrain Control Handle to Circle
« Reply #5 on: February 09, 2020, 04:09:08 PM »
shapes for reference

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3703
  • Ideas Visio-lized into solutions
Re: Constrain Control Handle to Circle
« Reply #6 on: February 09, 2020, 09:26:49 PM »
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

  • Hero Member
  • *****
  • Posts: 1381
Re: Constrain Control Handle to Circle
« Reply #7 on: February 10, 2020, 08:56:51 AM »
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.