12

I know that a triangle's mathematical center is not it's "visual" center, meaning it doesn't look good when aligned using the align tool, you have to use alternative methods. (Such as creating the triangle from the center and dragging outward proportionately)


Here's what puzzles me:

When I create the triangle from the center, and dragging out from the center, (You can see it's visually perfectly aligned and looks good). When I use the align tool it gets shifted over to that bad position.

Does that mean that holding down the Alt key doesn't actually properly align it to the center, and if so, is that a (better but possibly worse) fault in the drag from center tool (Hold down Alt key and drag)

enter image description here

Holding down Shift + Alt

  • 3
    why this works in your case is simple: "In the case of an equilateral triangle, the incenter, circumcenter and centroid all occur at the same point." [see joojaa's reference] Any other triangle would look off. – PieBie May 15 '17 at 8:05
  • There is a trick but only works for this specific case. Instead of aligning the center of both objects, you can align both tops and end up with a tequilateral triangle perfectly centered in a circle. – gota Jun 24 at 14:23
  • @gota that's what I would do if I already created the shape and couldn't recreate it. This question was really asking why Illustrator behaves like this and what the limitations were. I explained it simply an an answer recently. – WELZ Jun 24 at 15:12
11

Illustrator's align options use the bounding box as the area of definition, not the center point.

Therefore, when you click the align buttons, Illustrator is centering the triangle's bounding box within the circle's bounding box. It's not paying any attention to the actual center points.

The guides here represent the bounding boxes. (art shifts a bit when aligning, but they are the same size as you'll see at the end of the animation). enter image description here

In addition, when you draw holding the Option/Alt key down, you draw from area center - meaning everything moves outward equidistant from that center point. When you align, you align on visual center (which is what the bounding box center is). You'll notice the triangle's bounding box center is not actually centered in the triangle's area, it's visual centered based on shape edges.

I WISH there was some mechanism to align on actual centers in Illustrator, but pretty much all alignment options use the bounding box as reference. There's also no ability to show area center within Illustrator, only visual center.

  • 2
    I'd love to, but (updated answer) Illustrator doesn't have any ability to calculate the area of an object, which is what would be required. All AI knows is where the furthest segment or point lies, not how non-uniform edges may be. So, they'd need to add a lot of math to objects to center based upon area. – Scott May 15 '17 at 1:44
  • 2
    Illustrator has a way to calculate the area, its allready implemented... OTOH center is a diffuse concept for a triangle thats pretty easy. But for an arbitrar bezier not so much. So while center of gravity is easily computed for a shape its still off in many cases. See a triangle alone has many center definitions. – joojaa May 15 '17 at 4:50
7

Center of an arbitrary object is a bit diffuse concept. See there are four possible centers for a triangle. those are:

  • Center of Gravity (COG), aka. Centroid,
  • Circumcenter,
  • Incenter,
  • and Orthocenter.

Plus then you have the bounding box (BB) center which illustrator uses, but wait there is more, we have the minimal BB center and... Over 6 centers to consider. A same sided triangle is a special case where all of those circle centers lie in the same point, but that is not generally true. So you see the poor programmer is out of luck, whichever he chooses somebody is going to disagree with the choice.

Granted that only COG, Circumcenter and BB center make some sense for general triangle solutions.

triangle centers

Image 1: Possible centers of a triangle. Click to zoom.

For an arbitrary shape its even more complex than this. Its a game that few programmers can afford to play, their career is at stake. So they choose simple over debatable.

Unfortunately next the logical choice, the COG, which @Metis is talking about wouldn't work for arbitrary triangles the way you envision. Circumcenter is too esoteric work as a general solution for arbitrary shapes.

References:

Also see:

  • 1
    I love how both your answers answer the same question (Why doesn't this work in AI?) but are completely different. – PieBie May 15 '17 at 8:01
  • @PieBie im actually answering the question why this does not really work in most software out there. AI happens to be included. – joojaa May 15 '17 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.