Inkscape.org
Beginners' Questions How to center a triangle inside of a circle?
  1. #1
    ariel tp ariel tp @arar
    *

    I am trying to center a triangle inside a circle/rectangle to make a simple video file logo.

    I tried to center it using Align and Distribute -> Center x,y (relatively to biggest object) and this is the output:

    which is not centered like I want it to.

    Is there a way to center it like this:

    which is more to the right (it's not accurate using the mouse)

    I tried to change the triangle origin and then center it and it didn't even slightly move, and also I couldn't find an option of moving the origin to the shape mass and I had to move it manually which as I said didn't work.

     

    Is there a way to do it? /  Is there an option to move object origin to center of mass and making the 'Align and Distribute' take the origin point into account when calculating the center?

    Thanks.

  2. #2
    julioneto julioneto @julioneto

    it's actually in the middle. It's just a optical illusion. This is a common design problem, there are multiple always to overcome, but the program can't do magic here.

  3. #3
    ariel tp ariel tp @arar
    *

    This is not an optical illusion. I know it is centered. But it's not the centering behavior I want.

    Currently it centers something like this:

    triangle.setX(rectangle.x + rectangle.width/2 - triangle.width/2)

    triangle.setY(rectangle.y + rectangle.height/2 - triangle.height/2)

     

    But I want it to be something like this:

    triangle.setOrigin(CENTER_OF_MASS) // make the origin in the center of the mass and not in width/2, height/2.

    triangle.setX(rectangle.x + rectangle.width/2 - triangle.origin.x)

    triangle.setY(rectangle.y + rectangle.height/2 - triangle.origin.y) // center the object relatively to the origin not to the width and the height.

     

  4. #4
    Guerreiro64 Guerreiro64 @Guerreiro64

    I agree with julionetto. This also happens with the number 1. If you try to align a sequence of numbers, from 1 to 10, each inside a square and using Arial font... the number 1 will look misaligned.

  5. #5
    Tyler Durden Tyler Durden @TylerDurden
    *

    If the triangle is a shape object (polygon tool, not a path object) the rotation center can be used. This is different from the bounding box center on shapes with odd number sides.

  6. #6
    ariel tp ariel tp @arar
    *

    @TylerDurden How does this solve my problem?

    @Guerreiro64 , @julioneto This is not an optical illusion!

    Here you can see 2 icons, the first is the real YouTube icon I downloaded, And the second is the same icon but I cropped out the triangle and centered it inside the rectangle using 'Align and Distribute' centering. As you can see the both icons have the same dimensions and bounding box but the first triangle is more to the right 

    I assume the original icon just used centering by center of mass and not by bounding box and this is what I'm trying to realize how to do.

  7. #7
    Tyler Durden Tyler Durden @TylerDurden
    *

    Center of rotation is center of mass.🙄

  8. #8
    ariel tp ariel tp @arar

    @TylerDurden but the Align and Distribute doesn't take it into account it keeps using the bounding box center

  9. #9
    ariel tp ariel tp @arar
    *

    Thanks @TylerDurden, I found the solution. one of the snapping option is to snap the center of rotation to center of object, 

    Do you know how to do this with path object?

  10. #10
    julioneto julioneto @julioneto

    ariel, there's no such thing as "center of mass". This wouldn't make any sense in graphical design. BTW, you used an equilateral triangle so the "center" is EXACTLY the center.

    By default the center of rotation is the center of the object, as so both snaps will have the very same result. It only will be different if you manually change the axis of rotation. Neither option will do what you expect because this is not logically possible, it's a arbitrary perception of position.

  11. #11
    ariel tp ariel tp @arar
    *

    @julioneto You are wrong. the center of mass of a triangle ABC is x= (Ax+ Bx + Cx) /3 ,  y= (Ay+ By+Cy) /3 

    suppose an equilateral triangle where A = (0,a)  , B = (0,-a) , C = (tan(60)*a, 0)  = (a√3, 0) 

    The center of mass is -> y= (a-a+0 /3) = 0 , x = (0+0+a√3) /3  = a / √3  -> COM = (a/√3, 0)

    the bounding rectangle of this triangle is (0,a), (0,-a) ,(a√3, a) , (a√3, -a) therefore the center of the bounding box, which is what inkscape works with is ( (0+a√3) /2 , a-a /2) = (a/(2√3) , 0)

    This is not the center of mass.

     

  12. #12
    Tyler Durden Tyler Durden @TylerDurden

    Maybe this: Extensions>Visualize path>Measure path>Center of Mass

     

  13. #13
    ariel tp ariel tp @arar

    @TylerDurden Thanks!

  14. #14
    julioneto julioneto @julioneto

    This tutorial explain the problem with optical illusion in graphic design

    https://www.youtube.com/watch?v=S8ciDwLvKDk&t=114s

  15. #15
    Tyler Durden Tyler Durden @TylerDurden

    I have not seen the video, but can attest to the phenomenon of visual positioning diverging from geometric. It's one of the first things taught in design studies. 

     

  16. #16
    Guerreiro64 Guerreiro64 @Guerreiro64

    Exactly. There are design questions that you can't solve in math. In letter design, for example: if you put even spaces between the letters, it will look weird. This figure shows the ideal spacing between the typefaces... but this should not be taken rigidly: there are fonts that do not follow all these specifications.

     

    Letras 005
  17. #17
    ariel tp ariel tp @arar
    *

    @Guerreiro64 it's not an optical illusion, we define centering in different ways, I just solved it using snapping center of rotation to center of bounding box which gives the exact same result as the original logo of YouTube like I originally wanted.

    In my opinion that looks better than regular centering.

  18. #18
    Guerreiro64 Guerreiro64 @Guerreiro64

    • ariel tp: I added these yellow and blue figures from your image. See that the first object is not centered according to measurements, but visually. On the second object, it is centered according to measurements, but not visually.

    That's what I mean...

     

    Design Problem123
  19. #19
    Tyler Durden Tyler Durden @TylerDurden
    👍

    Those blue blocks are supposed to be centered?

    Not even close, but maybe I'm missing the point.

  20. #20
    Guerreiro64 Guerreiro64 @Guerreiro64

    You're right: sorry, I made this scheme a bit hasty. :)

    In fact, the blue squares are being useless there and can be disregarded. For our discussion, what matters are the yellow elements...

  21. #21
    ariel tp ariel tp @arar

    @Guerreiro64 I think you didn't understand the question. the question is about horizontally centering mot vertically 

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to center a triangle inside of a circle?