Absolute scaling of circle body
See original GitHub issueIs there any possibility to scale circle with absolute value? Body.scale
method is relative to current size. I have to scale it down, and then scale it back to initial size. I could do the math to reverse the scaling, but in this case the value depends on object position.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Absolute Scaling - Foundry Learn
Absolute Scaling allows you to determine the dimensions of your mesh and then rescale it uniformly, explicitly or in reference to the dimensions...
Read more >Absolute Vs. Perceptual – Chelsey Cu - UBC Blogs
Absolute scaling is when the size of the circle is in direct proportion to the value of the data. So, a city with...
Read more >Mohr's circle - Wikipedia
Mohr's circle is a two-dimensional graphical representation of the transformation law for the Cauchy stress tensor. Figure 1. Mohr's circles for a ...
Read more >The relative error % of the absolute scale estimate as a ...
The relative error % of the absolute scale estimate as a function of the rotation angle θ. Comparison between the linear 3-point method...
Read more >Responsively scale an absolutely positioned element
Below is the CSS I applied to the image. .upper-partial-circle { position:absolute; z-index: 1; left: -10%; max-height: 300px; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
One thing to know is that unlike in a graphics engine, bodies keep their own geometry absolute in world-space for performance reasons, as well as to simplify the overall implementation.
So if you need some sense of ‘absolute scale’ you should keep track of all scaling applied relative to the initial scale. In other words every time you scale the body using
Body.scale(body, scale, scale)
, also keep track of that by scaling a stored scale factor at the same time e.g.body._currentScale *= scale
.Then to revert to the original scale for example, you can do this:
I also needed to scale the body, and with easing, which was to complex math for me. Solved it for any shape (single part only) by storing two copies of the vertices-array. One with the original and one with manipulated values. In the animation, gasp I’m my case. I multiply the original vertices with a scale-factor and save to the manipulated array (by index to avoid creating new arrays each frame). Then set the vertices on the body. Then finally applying rotation on the vertices to the same as the current body.angle, because body rotations are changing it’s vertices.