Arc-spline update

The input for the first version of the Arcspline function required the coordinates of the centre of each arc, as well as the angle of the tangents at each end of the arc.  I have now added a new version with simplified input in a 4 column range.

The new file may be downloaded from: IP2.zip

The required inputs are:

  • Row 1: XY coordinates of the start point
  • For each arc: XY  coordinates of the intersection point of the tangents at the ends of the arc, the arc radius, and the number of segments for each arc
  • Last row: XY coordinates of the end point

Options:

  • If the spline is a closed curve the end point may be omitted.
  • If the spline is not closed,  set the optional second argument (Closearc) to False.  In this case the end point must be provided.
  • The default return array is the coordinates of the spline curve.  If the third argument (Out) = 1, details of each arc will be returned (see screen shot below for details).

Since the new function input will usually be much more convenient than the original version, it has been named ArcSpline, and the original function has been renamed ArcSpline2.

Input and output for an asymmetric I section with varying radius fillets:

Output with Out = 1:

This entry was posted in Coordinate Geometry, Excel, Maths, Newton, UDFs, VBA and tagged , , , , . Bookmark the permalink.

7 Responses to Arc-spline update

  1. Craig says:

    Hi Doug
    If I want zero radius at a given point, the example reports an error. For example drawing a steel section with root radii handled by the code and all the other points simply being just a point with no radius applied. Is it possible to add a check for this condition?

    Also in the ‘IP’ functions, the code return an error when there are more intersections present than points defining by either of the lines. I believe you limit the output to a max number of intersections being equal to the max number of points defining either of the lines. To demonstrate the error in an extreme way, if I use {=IP(line1, line2)} on a set of lines that zig-zags vertically (line 1) and a similar line that zig-zags horizontally (line 2) with all individual lines crossing each other.

    Each line crosses the other (2 x number of points -1), so with 6 points defined either side of the zig-zags, there would be a total of ((2×6)-1)^2 intersections = 121 intersections, but this causes an error as each line only has 12 defined points, and this is the max intersections considered in the code array. Can you possibly amend so the code finds/reports all intersections, and then trims the final array to the correct size or fills in the rest of the values as ‘NO MORE IP’s’ or something? I got it running to report all intersections by simply removing the limit (multiplying maxrows variable by a larger number).

    Many thanks for the great routines!

    Like

  2. Craig says:

    One other thing I just noticed in the IP code, if you have blank values in the line1 definition range, the code reports some non-intersection points as well.

    Say by extending the input range beyond the end of the data. I think its because its assuming a final line back to 0,0 form the last true point, so is picking up any intersections with this unintended segment of the line and the other line2 data. Only thing I can think of is to check if zero is entered vs nothing being entered in the last used row of the line ranges?

    Regards
    Craig

    Like

  3. Craig says:

    Hi Doug

    One more funny thing going on. In your example workbook, for the IP function if you put a square for line 1 (600 wide and 300 high, centered at 0,0), and a horizontal line intersecting this at y=50mm at both ends, the y values come out at 37.5mm vs the expected 50mm as its a horizontal line after all at y=50mm.

    Believe there is something going wrong somewhere, altering the y values of line 1 seems to affect the answer when it should not impact on the y value of the intersections. Just let me know if you are not seeing the same behaviour and I can email you some screen shots.

    Regards
    Craig

    Like

    • dougaj4 says:

      Thanks for the feedback Craig, I’ll get back to you as soon as I can.

      Like

      • Craig says:

        thanks Doug, I also seem to be getting errors using the IPLC routine as well if the center of the circle is defined at (0,0) under some circumstances (like vertical line) and also when DX=0 there is no error handling to capture the error that occurs if the line does not intersect with the circle. Hopefully you can reproduce these.

        Like

  4. dougaj4 says:

    Craig – I have fixed the two problems raised in your first message (I hope). I haven’t looked at the blank lines yet or the IPLC function, and I couldn’t replicate your problem with a line intersecting a square.
    You can download the revised spreadsheet from:
    http://interactiveds.com.au/software/IP2-dev.xlsb

    Could you send any further problems to my gmail address (dougaj4), and I’ll post an update here when everything is fixed.
    Thanks again for your time on this.

    Like

    • Craig says:

      Hi Doug, I sent you an email with an example of the incorrect intersection I am seeing for the square/horizontal line case.
      Regards
      Craig

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.