Can I lock the area or perimeter of a shape?

Started by Jennifer, March 17, 2022, 06:44:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jennifer

I had a question from a high school student the other day about the area of a parallelogram. I was thinking about some illustrations. Is there a way I can "lock" the area or perimeter of a parallelogram shape (or any shape) so that they remain constant as the shape is changed?

Here are 2 examples. I had to manually resize them to make it work. Is there any way to lock the area in the first example and the permeter in the second one so that I can just drag the left side to get from the first shape to the second?



Thanks

PS: I just tried locking the width and the height (separately). That doesn't do it.
Using Visio 2019, part of Office 365 on Windows 10

Paul Herber

If you look at the shape in terms of triangles then the length of the diagonal is like a hypotenuse of a right-angled triangle, and its length will be tangent of the ratio of parts of the height and width, this can tend to infinity as the angle gets very small.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Jennifer

Quote from: Paul Herber on March 17, 2022, 06:59:11 PM
If you look at the shape in terms of triangles then the length of the diagonal is like a hypotenuse of a right-angled triangle, and its length will be tangent of the ratio of parts of the height and width, this can tend to infinity as the angle gets very small.

Yes, that's true. I don't understand what point you are making.
Using Visio 2019, part of Office 365 on Windows 10

wapperdude

What Paul was driving at...apply geometry to generate a formula.  I think, SETATREF() helps in this case.  Maybe just SETF() is sufficient.

Let width (w) be the independent variable and height (h) the dependent variable.  Plus, for kicks, let area (a) be a shape data entry.

For the constant area case, width is arbitrarily set via drawing / GUI.  The user enters a value for area.  Then, use math to generate the height value:  setf(getref(Height), a/w). 

Do similar for constant perimeter.  The math is slightly more involved as you must solve h. 
Visio 2019 Pro

Jennifer

Quote from: wapperdude on March 17, 2022, 08:00:46 PM
What Paul was driving at...apply geometry to generate a formula.  I think, SETATREF() helps in this case.  Maybe just SETF() is sufficient.

Let width (w) be the independent variable and height (h) the dependent variable.  Plus, for kicks, let area (a) be a shape data entry.

For the constant area case, width is arbitrarily set via drawing / GUI.  The user enters a value for area.  Then, use math to generate the height value:  setf(getref(Height), a/w). 

Do similar for constant perimeter.  The math is slightly more involved as you must solve h.

Aha! I have never used any of these formulas. Is there a tutorial I can study to get up to speed? Or can you walk me thru setting up one or at least give me a basic outline?

Thanks
Using Visio 2019, part of Office 365 on Windows 10

wapperdude

I've got some running around to do, so, it will be awhile.

But, for the constant area case, just place the formula in the height cell.  However, instead of "w", use width.  And, for simplicity, instead of "a", pick a numeric value.  You probably should put a guard fcn around the formula to prevent it from getting clobbered.
Visio 2019 Pro

Jennifer

Here's what I'd like to learn how to do. The parallelogram shape looks like it might be a good place to start. I'd like to create 2 shapes: one with constant height and one with constant side. Both would have a constant base.

My shape would have these parameters: base, height, side, and theta.



I'd like to be able to drag a corner or a side or a yellow dot like I see on shapes like the arc shape above to change the theta. These are the equations:



The arc shape looks like a good example. There are 2 white controls (dots?) and one yellow. The white ones change the overall size. The yellow changes the angle.

I'll go looking for tutorials, but if anyone can provide a good link, please let me know.

Thanks
Using Visio 2019, part of Office 365 on Windows 10

vojo

check the protections
   - enable developer mode  (file ==> options ==> advanced options
   - Go to developer tab ==> protections

You can protect  height, width, format, etc.

vojo

As wapperdude pointed out, you can used guard to do this as well

enable developer mode
open the shapesheet for this shape
once in, set guard

width = guard (43mm)
height = guard (93mm)
etc

you can get more sophisticated to all editing under control
- can use props section to allow drop down to enter numbers
     width = guard (props.mywidth)
     height = guard (props.myheight)
- you can use control points to give dynamic handles to your shape
     here, this is more complicated
     controls1.x = width * 1
     controls1.y = height * 1
     Geometry1,x1 = width *0.5                                             geometry1.y1 = height *0.5
     Geometry1.x2 = guard(geometry1.x1 + controls1.x /2)     geometry1.y2 = guard(geometry1.y1-controls1.y/2)
     etc
     
- you can look at the family of shapesheet functions of SETREFEXPR(blah blah blah)
     These functions are complicated and you should play around with them before implementing on your shape
     Using this family is more art than science ;-)