• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Finding a Point on a Path

Explorer ,
Sep 22, 2012 Sep 22, 2012

Copy link to clipboard

Copied

Is there any way to find a specific point on a path, that is not necessarily an anchor point?

What I'd like to be able to do is tell Illustrator "Give me the coordinates of the point that's exactly at half of this path's length" or "... exactly 25% ...". And if that's possible, can I somehow add an anchor point to that point, or cut the path at that point?

Thanks!

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Sep 23, 2012 Sep 23, 2012

Copy link to clipboard

Copied

For straight lines only, or optionally for curved lines as well? For a given straight path segment, or any object?

Straight lines is straightforward interpolation:

for every pair of points (A,B) test if your target is between Ax and Bx, and Ay and By. If so, your coordinates are Ax+d*(Bx-Ax) and Ay+d*(By-Ay) (where d is your factor in decimals, 25% is 0.25).

Curved lines are represented by Bézier curves, and there is no straightforward solution. In that case you have to subdivide the curve until you are "close enough". Still fairly easy, but I cannot type *that* from memory. 🙂

Note that there is a difference in the order of points: 25% up the path from A to B is different then from B to A.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 23, 2012 Sep 23, 2012

Copy link to clipboard

Copied

With Scriptographer it is really easy:

http://scriptographer.org/reference/ai/path/#

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 23, 2012 Sep 23, 2012

Copy link to clipboard

Copied

Thanks! Yeah, I'm trying to avoid Scriptographer, since there's no version for CS6 in sight.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 23, 2012 Sep 23, 2012

Copy link to clipboard

Copied

LATEST

What I think you will need to do is… avoid the pathPoints.add() method this adds a point to the end of the current path then allows you to move it's position… Store all path points to an array, insert your new pathPoint item into that array then use the pathItem.setEntirePath() method… Me and Monsieur Bézier are going to have to have words one day…

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines