phaser/src/curves/EllipseCurve.js

646 lines
16 KiB
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
2019-01-15 16:20:22 +00:00
* @copyright 2019 Photon Storm Ltd.
2018-02-12 16:01:20 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog)
2018-02-13 00:40:51 +00:00
var Class = require('../utils/Class');
var Curve = require('./Curve');
var DegToRad = require('../math/DegToRad');
var GetValue = require('../utils/object/GetValue');
var RadToDeg = require('../math/RadToDeg');
var Vector2 = require('../math/Vector2');
2018-03-19 15:53:55 +00:00
/**
* @typedef {object} JSONEllipseCurve
*
* @property {string} type - The of the curve.
2018-09-28 09:32:58 +00:00
* @property {number} x - The x coordinate of the ellipse.
* @property {number} y - The y coordinate of the ellipse.
2018-03-19 15:53:55 +00:00
* @property {number} xRadius - The horizontal radius of ellipse.
* @property {number} yRadius - The vertical radius of ellipse.
2018-09-28 09:32:58 +00:00
* @property {integer} startAngle - The start angle of the ellipse, in degrees.
* @property {integer} endAngle - The end angle of the ellipse, in degrees.
* @property {boolean} clockwise - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false)
* @property {integer} rotation - The rotation of ellipse, in degrees.
2018-03-19 15:53:55 +00:00
*/
2018-03-27 12:06:24 +00:00
/**
* @typedef {object} EllipseCurveConfig
*
2018-09-28 09:32:58 +00:00
* @property {number} [x=0] - The x coordinate of the ellipse.
* @property {number} [y=0] - The y coordinate of the ellipse.
* @property {number} [xRadius=0] - The horizontal radius of the ellipse.
* @property {number} [yRadius=0] - The vertical radius of the ellipse.
* @property {integer} [startAngle=0] - The start angle of the ellipse, in degrees.
* @property {integer} [endAngle=360] - The end angle of the ellipse, in degrees.
* @property {boolean} [clockwise=false] - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false)
* @property {integer} [rotation=0] - The rotation of the ellipse, in degrees.
2018-03-27 12:06:24 +00:00
*/
2018-02-07 15:27:21 +00:00
/**
* @classdesc
2018-09-28 09:32:58 +00:00
* An Elliptical Curve derived from the Base Curve class.
*
* See https://en.wikipedia.org/wiki/Elliptic_curve for more details.
2018-02-07 15:27:21 +00:00
*
2018-05-23 14:04:54 +00:00
* @class Ellipse
2018-02-07 15:27:21 +00:00
* @extends Phaser.Curves.Curve
2018-10-10 09:49:13 +00:00
* @memberof Phaser.Curves
2018-02-07 15:27:21 +00:00
* @constructor
* @since 3.0.0
*
2018-09-28 09:32:58 +00:00
* @param {(number|EllipseCurveConfig)} [x=0] - The x coordinate of the ellipse, or an Ellipse Curve configuration object.
* @param {number} [y=0] - The y coordinate of the ellipse.
* @param {number} [xRadius=0] - The horizontal radius of ellipse.
* @param {number} [yRadius=0] - The vertical radius of ellipse.
* @param {integer} [startAngle=0] - The start angle of the ellipse, in degrees.
* @param {integer} [endAngle=360] - The end angle of the ellipse, in degrees.
* @param {boolean} [clockwise=false] - Sets if the the ellipse rotation is clockwise (true) or anti-clockwise (false)
* @param {integer} [rotation=0] - The rotation of the ellipse, in degrees.
2018-02-07 15:27:21 +00:00
*/
var EllipseCurve = new Class({
Extends: Curve,
initialize:
2017-09-22 00:34:39 +00:00
function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation)
{
if (typeof x === 'object')
{
var config = x;
x = GetValue(config, 'x', 0);
y = GetValue(config, 'y', 0);
xRadius = GetValue(config, 'xRadius', 0);
yRadius = GetValue(config, 'yRadius', xRadius);
startAngle = GetValue(config, 'startAngle', 0);
endAngle = GetValue(config, 'endAngle', 360);
clockwise = GetValue(config, 'clockwise', false);
rotation = GetValue(config, 'rotation', 0);
}
else
{
if (yRadius === undefined) { yRadius = xRadius; }
if (startAngle === undefined) { startAngle = 0; }
if (endAngle === undefined) { endAngle = 360; }
if (clockwise === undefined) { clockwise = false; }
if (rotation === undefined) { rotation = 0; }
}
2017-09-21 02:07:42 +00:00
Curve.call(this, 'EllipseCurve');
// Center point
2018-01-25 05:26:13 +00:00
/**
2018-09-28 09:32:58 +00:00
* The center point of the ellipse. Used for calculating rotation.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#p0
2018-02-13 00:40:51 +00:00
* @type {Phaser.Math.Vector2}
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*/
this.p0 = new Vector2(x, y);
2018-01-25 05:26:13 +00:00
/**
2018-09-28 09:32:58 +00:00
* The horizontal radius of the ellipse.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#_xRadius
2018-02-13 00:40:51 +00:00
* @type {number}
2018-01-25 05:26:13 +00:00
* @private
* @since 3.0.0
*/
this._xRadius = xRadius;
2018-01-25 05:26:13 +00:00
/**
2018-09-28 09:32:58 +00:00
* The vertical radius of the ellipse.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#_yRadius
2018-02-13 00:40:51 +00:00
* @type {number}
2018-01-25 05:26:13 +00:00
* @private
* @since 3.0.0
*/
this._yRadius = yRadius;
2017-09-21 02:07:42 +00:00
// Radians
2018-01-25 05:26:13 +00:00
/**
2018-09-28 09:32:58 +00:00
* The starting angle of the ellipse in radians.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#_startAngle
2018-02-13 00:40:51 +00:00
* @type {number}
2018-01-25 05:26:13 +00:00
* @private
* @since 3.0.0
*/
this._startAngle = DegToRad(startAngle);
2018-01-25 05:26:13 +00:00
/**
2018-09-28 09:32:58 +00:00
* The end angle of the ellipse in radians.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#_endAngle
2018-02-13 00:40:51 +00:00
* @type {number}
2018-01-25 05:26:13 +00:00
* @private
* @since 3.0.0
*/
this._endAngle = DegToRad(endAngle);
2018-01-25 05:26:13 +00:00
/**
2018-02-13 00:40:51 +00:00
* Anti-clockwise direction.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#_clockwise
2018-02-13 00:40:51 +00:00
* @type {boolean}
2018-01-25 05:26:13 +00:00
* @private
* @since 3.0.0
*/
this._clockwise = clockwise;
2018-02-13 00:40:51 +00:00
/**
* The rotation of the arc.
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#_rotation
2018-02-13 00:40:51 +00:00
* @type {number}
* @private
* @since 3.0.0
*/
this._rotation = DegToRad(rotation);
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Gets the starting point on the curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#getStartPoint
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-27 12:06:24 +00:00
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
2018-03-18 13:43:37 +00:00
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
2018-01-25 05:26:13 +00:00
*
2018-03-18 13:43:37 +00:00
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
2018-01-25 05:26:13 +00:00
*/
getStartPoint: function (out)
{
if (out === undefined) { out = new Vector2(); }
return this.getPoint(0, out);
},
2018-01-25 05:26:13 +00:00
/**
* [description]
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#getResolution
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} divisions - [description]
2018-01-25 05:26:13 +00:00
*
2018-03-18 13:43:37 +00:00
* @return {number} [description]
2018-01-25 05:26:13 +00:00
*/
2017-09-21 16:12:16 +00:00
getResolution: function (divisions)
{
return divisions * 2;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Get point at relative position in curve according to length.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#getPoint
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-27 12:06:24 +00:00
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
2018-03-18 13:43:37 +00:00
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
2018-01-25 05:26:13 +00:00
*
2018-03-18 13:43:37 +00:00
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
2018-01-25 05:26:13 +00:00
*/
2017-09-21 02:07:42 +00:00
getPoint: function (t, out)
{
2017-09-21 02:07:42 +00:00
if (out === undefined) { out = new Vector2(); }
var twoPi = Math.PI * 2;
var deltaAngle = this._endAngle - this._startAngle;
var samePoints = Math.abs(deltaAngle) < Number.EPSILON;
// ensures that deltaAngle is 0 .. 2 PI
while (deltaAngle < 0)
{
deltaAngle += twoPi;
}
while (deltaAngle > twoPi)
{
deltaAngle -= twoPi;
}
if (deltaAngle < Number.EPSILON)
{
if (samePoints)
{
deltaAngle = 0;
}
else
{
deltaAngle = twoPi;
}
}
if (this._clockwise && !samePoints)
{
if (deltaAngle === twoPi)
{
deltaAngle = - twoPi;
}
else
{
deltaAngle = deltaAngle - twoPi;
}
}
var angle = this._startAngle + t * deltaAngle;
var x = this.p0.x + this._xRadius * Math.cos(angle);
var y = this.p0.y + this._yRadius * Math.sin(angle);
if (this._rotation !== 0)
{
var cos = Math.cos(this._rotation);
var sin = Math.sin(this._rotation);
var tx = x - this.p0.x;
var ty = y - this.p0.y;
// Rotate the point about the center of the ellipse.
x = tx * cos - ty * sin + this.p0.x;
y = tx * sin + ty * cos + this.p0.y;
}
2017-09-21 02:07:42 +00:00
return out.set(x, y);
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the horizontal radius of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setXRadius
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The horizontal radius of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setXRadius: function (value)
{
this.xRadius = value;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the vertical radius of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setYRadius
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The vertical radius of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setYRadius: function (value)
{
this.yRadius = value;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the width of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setWidth
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The width of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setWidth: function (value)
{
this.xRadius = value * 2;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the height of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setHeight
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The height of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setHeight: function (value)
{
this.yRadius = value * 2;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the start angle of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setStartAngle
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The start angle of this curve, in radians.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setStartAngle: function (value)
{
this.startAngle = value;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the end angle of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setEndAngle
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The end angle of this curve, in radians.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setEndAngle: function (value)
{
this.endAngle = value;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets if this curve extends clockwise or anti-clockwise.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setClockwise
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {boolean} value - The clockwise state of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setClockwise: function (value)
{
this.clockwise = value;
return this;
},
2018-01-25 05:26:13 +00:00
/**
2018-03-18 13:43:37 +00:00
* Sets the rotation of this curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#setRotation
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-18 13:43:37 +00:00
* @param {number} value - The rotation of this curve, in radians.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @return {Phaser.Curves.Ellipse} This curve object.
2018-01-25 05:26:13 +00:00
*/
setRotation: function (value)
{
this.rotation = value;
return this;
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The x coordinate of the center of the ellipse.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#x
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
x: {
2017-09-29 11:58:30 +00:00
get: function ()
{
return this.p0.x;
},
set: function (value)
{
this.p0.x = value;
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The y coordinate of the center of the ellipse.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#y
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
y: {
2017-09-29 11:58:30 +00:00
get: function ()
{
return this.p0.y;
},
set: function (value)
{
this.p0.y = value;
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The horizontal radius of the ellipse.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#xRadius
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
xRadius: {
2017-09-29 11:58:30 +00:00
get: function ()
{
return this._xRadius;
},
set: function (value)
{
this._xRadius = value;
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The vertical radius of the ellipse.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#yRadius
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
yRadius: {
2017-09-29 11:58:30 +00:00
get: function ()
{
return this._yRadius;
},
set: function (value)
{
this._yRadius = value;
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The start angle of the ellipse in degrees.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#startAngle
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
startAngle: {
2017-09-29 11:58:30 +00:00
get: function ()
{
2017-09-29 11:58:30 +00:00
return RadToDeg(this._startAngle);
},
set: function (value)
{
this._startAngle = DegToRad(value);
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The end angle of the ellipse in degrees.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#endAngle
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
endAngle: {
2017-09-29 11:58:30 +00:00
get: function ()
{
2017-09-29 11:58:30 +00:00
return RadToDeg(this._endAngle);
},
set: function (value)
{
this._endAngle = DegToRad(value);
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* `true` if the ellipse rotation is clockwise or `false` if anti-clockwise.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#clockwise
2018-03-19 15:53:55 +00:00
* @type {boolean}
2018-02-13 00:40:51 +00:00
* @since 3.0.0
*/
clockwise: {
2017-09-29 11:58:30 +00:00
get: function ()
{
return this._clockwise;
},
set: function (value)
{
this._clockwise = value;
}
2017-09-29 11:58:30 +00:00
},
2018-02-13 00:40:51 +00:00
/**
2018-09-28 09:32:58 +00:00
* The rotation of the ellipse, relative to the center, in degrees.
*
* @name Phaser.Curves.Ellipse#angle
* @type {number}
* @since 3.14.0
*/
angle: {
get: function ()
{
return RadToDeg(this._rotation);
},
set: function (value)
{
this._rotation = DegToRad(value);
}
},
/**
* The rotation of the ellipse, relative to the center, in radians.
2018-02-13 00:40:51 +00:00
*
2018-05-23 22:09:31 +00:00
* @name Phaser.Curves.Ellipse#rotation
2018-02-13 00:40:51 +00:00
* @type {number}
* @since 3.0.0
*/
rotation: {
2017-09-29 11:58:30 +00:00
get: function ()
{
return this._rotation;
},
set: function (value)
{
2018-09-28 09:32:58 +00:00
this._rotation = value;
}
2017-09-29 11:58:30 +00:00
},
2018-01-25 05:26:13 +00:00
/**
2018-09-28 09:32:58 +00:00
* JSON serialization of the curve.
2018-01-25 05:26:13 +00:00
*
2018-05-23 22:09:31 +00:00
* @method Phaser.Curves.Ellipse#toJSON
2018-01-25 05:26:13 +00:00
* @since 3.0.0
*
2018-03-19 15:53:55 +00:00
* @return {JSONEllipseCurve} The JSON object containing this curve data.
2018-01-25 05:26:13 +00:00
*/
toJSON: function ()
{
return {
type: this.type,
x: this.p0.x,
y: this.p0.y,
xRadius: this._xRadius,
yRadius: this._yRadius,
startAngle: RadToDeg(this._startAngle),
endAngle: RadToDeg(this._endAngle),
clockwise: this._clockwise,
rotation: RadToDeg(this._rotation)
};
}
});
2018-03-18 13:43:37 +00:00
/**
2018-09-28 09:32:58 +00:00
* Creates a curve from the provided Ellipse Curve Configuration object.
2018-03-18 13:43:37 +00:00
*
2018-05-23 22:09:31 +00:00
* @function Phaser.Curves.Ellipse.fromJSON
2018-03-18 13:43:37 +00:00
* @since 3.0.0
*
2018-03-19 15:53:55 +00:00
* @param {JSONEllipseCurve} data - The JSON object containing this curve data.
2018-03-18 13:43:37 +00:00
*
2018-09-28 09:32:58 +00:00
* @return {Phaser.Curves.Ellipse} The ellipse curve constructed from the configuration object.
2018-03-18 13:43:37 +00:00
*/
EllipseCurve.fromJSON = function (data)
{
return new EllipseCurve(data);
};
module.exports = EllipseCurve;