Visio Guy

Visio Guy Website & General Stuff => Latest Visio Guy Articles => Topic started by: Visio Guy on November 07, 2018, 09:11:18 PM

Title: Constrain Control Handle to Circle
Post by: Visio Guy on November 07, 2018, 09:11:18 PM
How to do something very useful and rather obscure:

Constrain Control Handle to Circle (http://www.visguy.com/2018/11/07/constrain-control-handle-to-circle/)
Title: Re: Constrain Control Handle to Circle
Post by: AndyW on November 08, 2018, 02:53:32 PM
Nice  :)
Title: Re: Constrain Control Handle to Circle
Post by: vojo on December 05, 2018, 08: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!!!!
Title: Re: Constrain Control Handle to ellipse
Post by: vojo on January 30, 2020, 04:12:30 AM
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
Title: Re: Constrain Control Handle to Circle, ellispsis, ellipsis arc
Post by: vojo on February 09, 2020, 08: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.
Title: Re: Constrain Control Handle to Circle
Post by: vojo on February 09, 2020, 09:09:08 PM
shapes for reference
Title: Re: Constrain Control Handle to Circle
Post by: wapperdude on February 10, 2020, 02:26:49 AM
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

Title: Re: Constrain Control Handle to Circle
Post by: vojo on February 10, 2020, 01:56:51 PM
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.