0

Is there a simple way of keeping the shape of the existing arc while changing its length? In other words, I would like the ends of the arc to extend further while keeping the same shape (if that makes any sense). I have about 100 of these arcs to modify.

Here's a link to one since SVG files cannot be attached.

An automatic solution would be nice, but I would rather not have to manually manipulate the handlers to affect the change. The files are stored in a folder in Dropbox.

  • 1
    Welcome to Graphic Design SE. Please edit your question to include a quick sketch of what you want to do. Also, please specify whether you require an automatic solution and if, how your 100 arcs are stored. – Wrzlprmft Feb 7 '17 at 12:16
  • What program(s) are you using? – Wolff Feb 7 '17 at 15:57
  • I am using Adobe Illustrator CC 2017. – Quint Rahaman Feb 7 '17 at 16:25
  • I have looked at your file and I am not sure it is possible. You can resize the shape (with or without the link between width and height), but it changes the shape. You need to know something about the mathematical function to be able to continue the shape. Like, for example, a straight line is easy to extend because the function is so basic, but if you have a segment of a circle, it would be easier to draw a new circle than to recreate the missing part of the circle. Illustrator wouldn't be able to guess that it had been a circle in its past life. – Wolff Feb 7 '17 at 21:16
  • I believe it would be best to start over; that is, start out with a larger arc and then slice it at the desired height/chord-length. Not sure how to go about doing that but Google has been a good friend. :-) Thanks for your help! – Quint Rahaman Feb 7 '17 at 21:59
0

A Bézier segment of a path is a polynomial. Just because we only use the curve to a parameter of range [0-1] does not mean the function does not exist outside this range, it does. Since this new curve is also a Bézier, so it can be described with a different Bézier curve accurately.

enter image description here

Image 1: Two Bézier curves that have been extended by 0.1 t in both directions.

I have used the following, extremely beta version, script:

#target illustrator

// extendSelectedSegment.jsx v0.0
//
// Copyright (c) 2017 Janne Ojala
// License: MIT see https://opensource.org/licenses/MIT

var Bezier = function(p1, p2, p3, p4) {
  if (p2 === undefined){
      this.paramsFromPath(p1);
  } else {
      this.p1 = p1;
      this.p2 = p2;
      this.p3 = p3;
      this.p4 = p4;
  }
};

Bezier.prototype.posAtParam = function(t){
   var p = [undefined, undefined];
   for (var i = 0; i < 2; i++){
   p[i] =   this.p1[i] * Math.pow(1 - t,3) 
          + this.p2[i] * 3 * t * Math.pow(1 - t,2) 
          + this.p3[i] * 3 * Math.pow(t,2) * (1 - t)
          + this.p4[i] * Math.pow(t,3);
   }
   return p;
}


Bezier.prototype.derivateAtParam = function(t){
   var d = [undefined, undefined];
   for (var i = 0; i < 2; i++){
   d[i] = - 3 * this.p1[i] * Math.pow(1 - t,2) 
          + 3 * this.p2[i] * Math.pow(1 - t,2) 
          - 6 * this.p2[i] * (1 - t) * t 
          + 6 * this.p3[i] * (1 - t) * t 
          - 3 * this.p3[i] * Math.pow(t,2) 
          + 3 * this.p4[i] * Math.pow(t,2);
   }
   return d;
}

Bezier.prototype.extendToParam = function(t, t2){
    // Extend only to one direction at time.
    if (t2 === undefined){
        t2 = t;
        t = 0;
    }
    var p4n = this.posAtParam(t2);
    var p3n = this.derivateAtParam(t2);
    for (var i = 0; i < 2; i++){
        p3n[i] = p4n[i] - ((t2-t)*p3n[i])/3; 
    }
    var p1n = this.posAtParam(t);
    var p2n = this.derivateAtParam(t);
    for (var i = 0; i < 2; i++){
        p2n[i] = p1n[i] + ((t2-t)*p2n[i])/3; 
    }
    return new Bezier(p1n, p2n, p3n, p4n);
}

Bezier.prototype.makePath = function(){
    pth = app.activeDocument.pathItems.add();
    var point1 = pth.pathPoints.add();
    point1.anchor = this.p1;
    point1.leftDirection = this.p1;
    point1.rightDirection = this.p2;

    var point2 = pth.pathPoints.add();
    point2.anchor = this.p4;
    point2.leftDirection = this.p3;
    point2.rightDirection = this.p4;
}

Bezier.prototype.paramsFromPath = function(pth){
    var point1 = pth.pathPoints[0];
    this.p1 = point1.anchor;
    this.p2 = point1.rightDirection;

    var point2 = pth.pathPoints[1];
    this.p3 = point2.leftDirection;
    this.p4 = point2.anchor;
}

var sel = app.activeDocument.selection;
var bez = new Bezier(sel[0]);
bez = bez.extendToParam(0, 1.1);
bez = bez.extendToParam(-0.1, 1.0);
bez.makePath();

Now bear in mind that this works for a single selected path and has no checks. This script is posted as is and should be handled with care. But otherwise your free to do anything you like with it as long as you keep the attribution/license for my parts of the code.

Note: I am extending the Bézier function, this does not always yield a very "natural" extension as it uses the underlying function and that CAN turn on itself if you are near a situation that would make a cusp.

  • Hmm, works good at one end and does a u-turn at the other i.stack.imgur.com/2UREg.png – Cai Feb 8 '17 at 17:27
  • @Cai thats how the bezier it behaves in certain cases if the other end does not have a tangent or its very short! – joojaa Feb 8 '17 at 17:46
  • @Cai you dont have to take my word for it you can see pomax.github.io/bezierinfo/#extended butyes my code has some stability issues in certain corner cases thats why the version is 0,0 – joojaa Feb 8 '17 at 17:51
  • @joojaa, you rock!!! That worked swimmingly! Thank you very much. – Quint Rahaman Feb 8 '17 at 23:12
1

Not sure an automated solution is possible but the VectorScribe plugin by Astute Graphics has an "Extend Path" tool which can do this manually. It has a couple of different modes for calculating the path it is extending and is as easy as dragging out the path you want to extend.

You can see some examples (and how to use the keyboard shortcuts) here:

The plugin is £69 (or whatever that is in your local currency), but it does also have a 14 day free trial which may be enough for you to do what you need.

  • A bezier is just a polynomial, You can easily re reange the polynomial to a different length. Yes we can script this, it so happens that i wrote this as a script 1 week ago. – joojaa Feb 8 '17 at 13:39
  • Well, that sounds an awful lot like a good answer to the question here... – Cai Feb 8 '17 at 13:45
  • sure but i dont have the code with me at work. Also it probably needs a GUI? – joojaa Feb 8 '17 at 13:46
  • A GUI helps yeh, but a script with no GUI is better than no script at all – Cai Feb 8 '17 at 14:19
  • Thanks for your suggestion. That would also work. Between yours and the answer from @jooja, I am guessing the script would be faster? – Quint Rahaman Feb 8 '17 at 16:30
0

If you only want to change the arc width without effecting the height make sure the link between width and height is unchecked.

change width gif example

If you want to change multiple arcs at the same time you can select the arcs and go to Object -> Transform -> Scale. Change the scale to Non-Uniform and input a larger percentage.

I would like the ends of the arc to extend further while keeping the same shape.

There is no way to extend the arc and keep the same shape because that will distort the arc curve.

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.