Message Boards Message Boards

0
|
1583 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Centering a rectangle inside another?

Posted 2 years ago
Graphics[{
  Rectangle[], Rectangle[{1, 1} ],
  Purple, Rectangle[ {0, 1}], Rectangle[{1, 0}],
  Yellow, Scale[Rectangle[], 0.5], Scale[Rectangle[{1, 1}], 0.5],
  Green, Scale[Rectangle[{0, 1}], 0.5], Scale[Rectangle[{1, 0}], 0.5]
 }, Axes -> True]

Please tell me the principle of Scale function.
Thanks

enter image description here

POSTED BY: yuki kana
2 Replies
Posted 2 years ago

Yuki, when testing the code in Mathematica 12.2 I can reproduce the problem. Looks like a bug in 12.2 (and earlier versions?)

enter image description here

POSTED BY: Hans Milton
Posted 2 years ago

I cannot reproduce the problem. Executing the following code gives the expected output:

Graphics[{
    Rectangle[], Rectangle[{1, 1}],
    Purple, Rectangle[{0, 1}], Rectangle[{1, 0}],
    Yellow, Scale[Rectangle[], 0.5], Scale[Rectangle[{1, 1}], 0.5],
    Green, Scale[Rectangle[{0, 1}], 0.5], Scale[Rectangle[{1, 0}], 0.5]
  }, Axes -> True]

enter image description here

EDIT:

The above was tested in Mathematica 12.3. But in 12.2 the problem can be reproduced. See my post below.

POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract