From bd1154c7bf7f4e50bd81c6bc31ace838772246e5 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Tue, 26 Sep 2017 17:01:22 +0100 Subject: [PATCH] Both Curve and Path now expose getStartPoint and getEndPoint --- v3/src/paths/Path.js | 7 +++++++ v3/src/paths/curves/Curve.js | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/v3/src/paths/Path.js b/v3/src/paths/Path.js index 7debaa45d..7727a87a2 100644 --- a/v3/src/paths/Path.js +++ b/v3/src/paths/Path.js @@ -111,6 +111,13 @@ var Path = new Class({ return this; }, + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.startPoint); + }, + getEndPoint: function (out) { if (out === undefined) { out = new Vector2(); } diff --git a/v3/src/paths/curves/Curve.js b/v3/src/paths/curves/Curve.js index d2cc41b84..264315383 100644 --- a/v3/src/paths/curves/Curve.js +++ b/v3/src/paths/curves/Curve.js @@ -25,7 +25,22 @@ var Curve = new Class({ this.needsUpdate = true; }, + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPointAt(0, out); + }, + + getEndPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPointAt(1, out); + }, + // Get point at relative position in curve according to arc length + // - u [0 .. 1] getPointAt: function (u, out)