Calculate rectangle position after scaling from his center
$begingroup$
I have a rectangle with these bounds
height: 31.010414123535156
width: 215.8330078125
x: 10.95849609375
y: 90.49478912353516
I want to scale up the rectangle by a 0.541667
factor.
X, Y coordinates are coordinates of the top left corner.
I know that the scale origin is the center of the rectangle.
To find the width and height I simply did this calculate
newWidth = width / 0.541667
newHeight = height / 0.541667
But I can't figure out how to calculate the new x
and y
coordinates.
Which gives me these bounds
height: 57.25
width: 398.4609375
x: -80.35546875 //how to find this value ?
y: 77.375 //how to find this value ?
geometry transformation
$endgroup$
add a comment |
$begingroup$
I have a rectangle with these bounds
height: 31.010414123535156
width: 215.8330078125
x: 10.95849609375
y: 90.49478912353516
I want to scale up the rectangle by a 0.541667
factor.
X, Y coordinates are coordinates of the top left corner.
I know that the scale origin is the center of the rectangle.
To find the width and height I simply did this calculate
newWidth = width / 0.541667
newHeight = height / 0.541667
But I can't figure out how to calculate the new x
and y
coordinates.
Which gives me these bounds
height: 57.25
width: 398.4609375
x: -80.35546875 //how to find this value ?
y: 77.375 //how to find this value ?
geometry transformation
$endgroup$
add a comment |
$begingroup$
I have a rectangle with these bounds
height: 31.010414123535156
width: 215.8330078125
x: 10.95849609375
y: 90.49478912353516
I want to scale up the rectangle by a 0.541667
factor.
X, Y coordinates are coordinates of the top left corner.
I know that the scale origin is the center of the rectangle.
To find the width and height I simply did this calculate
newWidth = width / 0.541667
newHeight = height / 0.541667
But I can't figure out how to calculate the new x
and y
coordinates.
Which gives me these bounds
height: 57.25
width: 398.4609375
x: -80.35546875 //how to find this value ?
y: 77.375 //how to find this value ?
geometry transformation
$endgroup$
I have a rectangle with these bounds
height: 31.010414123535156
width: 215.8330078125
x: 10.95849609375
y: 90.49478912353516
I want to scale up the rectangle by a 0.541667
factor.
X, Y coordinates are coordinates of the top left corner.
I know that the scale origin is the center of the rectangle.
To find the width and height I simply did this calculate
newWidth = width / 0.541667
newHeight = height / 0.541667
But I can't figure out how to calculate the new x
and y
coordinates.
Which gives me these bounds
height: 57.25
width: 398.4609375
x: -80.35546875 //how to find this value ?
y: 77.375 //how to find this value ?
geometry transformation
geometry transformation
edited Dec 29 '18 at 9:49
zaarr78
asked Dec 29 '18 at 9:21
zaarr78zaarr78
32
32
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Your results make sense only if your $x$-axis goes from left to right, $y$-axis goes from top to bottom and $(x,y)$ denotes the coordinate of the top left corner of the rectangle. Such coordinate system is typically used for computer screens. In that case:
newX = x + width/2 - newWidth/2
newY = y + height/2 - newHeight/2
Check your values and you'll see that the numbers match.
$endgroup$
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3055683%2fcalculate-rectangle-position-after-scaling-from-his-center%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Your results make sense only if your $x$-axis goes from left to right, $y$-axis goes from top to bottom and $(x,y)$ denotes the coordinate of the top left corner of the rectangle. Such coordinate system is typically used for computer screens. In that case:
newX = x + width/2 - newWidth/2
newY = y + height/2 - newHeight/2
Check your values and you'll see that the numbers match.
$endgroup$
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
add a comment |
$begingroup$
Your results make sense only if your $x$-axis goes from left to right, $y$-axis goes from top to bottom and $(x,y)$ denotes the coordinate of the top left corner of the rectangle. Such coordinate system is typically used for computer screens. In that case:
newX = x + width/2 - newWidth/2
newY = y + height/2 - newHeight/2
Check your values and you'll see that the numbers match.
$endgroup$
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
add a comment |
$begingroup$
Your results make sense only if your $x$-axis goes from left to right, $y$-axis goes from top to bottom and $(x,y)$ denotes the coordinate of the top left corner of the rectangle. Such coordinate system is typically used for computer screens. In that case:
newX = x + width/2 - newWidth/2
newY = y + height/2 - newHeight/2
Check your values and you'll see that the numbers match.
$endgroup$
Your results make sense only if your $x$-axis goes from left to right, $y$-axis goes from top to bottom and $(x,y)$ denotes the coordinate of the top left corner of the rectangle. Such coordinate system is typically used for computer screens. In that case:
newX = x + width/2 - newWidth/2
newY = y + height/2 - newHeight/2
Check your values and you'll see that the numbers match.
edited Dec 29 '18 at 10:04
answered Dec 29 '18 at 9:28
OldboyOldboy
9,54911138
9,54911138
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
add a comment |
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
$begingroup$
X, Y coordinates are top left corner I updated my question
$endgroup$
– zaarr78
Dec 29 '18 at 9:49
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3055683%2fcalculate-rectangle-position-after-scaling-from-his-center%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown