IannixCurve explanation of what IannixCurve is and/or does
Inherits from: Object : IannixObject
! See first: IannixObject for common variables and methods for all Iannix objects.
Creation / Class Methods
*new (parent, id)
parent - mandatory. must be an instance of Iannix class.
id - if nil: automatically incremented, based on already created object of this type, and default offset for this type.
// example
i = Iannix.new;
l = IannixCurve.new(i); //creation in sclang
l.send;
l.points_([0@0, 3@3]); //a simple line with two points (see later).
Note: Its better to create a curve this way (automatic indexation, sending and positionning):
i = Iannix.new;
l = i.curve([0@1, 10@1]);
Redefining
points_ (pointsArray)
the points that will 'build' the curve
pointsArray
- a list of Point instances, i.e. the coordinates of the defining point onto the Iannix application score.
- accepts different types of point definitions:
a point can be:
- a Point instance (eg. 2@3) , witch will add a point in the 2D plane (x, y).
- a pair (eg. [2, 3]), witch will add a point in the 2D plane. (x, y)
- a triplet (eg. [2, 3, -1]), , witch will add a point in the 3D plane. (x, y, z).
-a couple of lists:
the first list will be a pair or a triplet, witch will represent the coordinates in the 2D or 3D plane,
the second list will contain 4 or 6 elements, defining the bezier start and end tangent , in the 2D or 3D plane:
-2D beziers: [2, 2, 0, 2] will represent the start tangent (the two first values) and end tangent (the two last values) in the 2D plane => 4 values
-3D beziers: [0, -2, 2 , 5, 0, 0] will represent the start tangent (the three first values) and end tangent (the three last values) in the 3D plane => 6 values
complete representation of a point with beziers: [ [x, y, (z)], [startTangent_x, startTangent_y, (startTangent_z), endTangent_x, endTangent_y, (endTangent_z)] ]
fromSVGpath (svgPath, width, height)
//note, I can't make it to work :(
svgPath - A SVG path, as string.
width - width of the curve representation.
height - height of the curve representation.
(
//svgPath ~svg="M637.599,1569.972c0,0,89.127,0,222.818,0c8.913,0,18.023,0,27.381,0.113C901,1570,913,1573,926,1576c67,15,128,43,198,28c9-2,17.833-4.277,26.554-6.685c8.72-2.407,17.255-5.074,25.247-8.562C1224,1567,1239,1514,1256,1469c18-48,69-29,101-9c81.375,48.125,161.219,103.141,254.032,110.08c13.259,0.991,26.782,1.001,40.616-0.129C1716,1574,1788,1562,1842,1606c39,32,62,97,119,90c44-6,70-47,101.551-72.846";
)
i = Iannix.new;
i.removeAll(true);
l = i.curve.fromSVGpath(~svg, 0, 0);
fromSVGpath2 (svgPath, scale)
The SVG path of these curves is simply a set of points (absolutely positioned).
svgPath - a serie of points, or a serie of pairs.
scale - Default value is 1.
i = Iannix.new;
l = i.curve.fromSVGpath2([1@1, 1@2, -1@2, -1 @ -2, -2@0], 1);
asEllipse (width, height)
Ellipses are defined by a major axis and a minor axis.
width - Default value is 1.
height - Default value is 1.
i = Iannix.new;
l = i.curve.asEllipse(3, 2);
fromText (text, scale, fontFamily)
uses a text as a basis for vectorisation.
text - self explanatory - Default value is nil
scale - Default value is 0.1
fontFamily - Default value is "Arial".
i = Iannix.new;
l = i.curve.fromText("hello");
l.fromText("world!");
fromImage (imagePath, scale)
automatic vectorization from a png file.
imagePath - Default value is nil.
scale - Explanation of scale. Default value is 1. Other information.
i = Iannix.new;
l = i.curve.fromImage(Document.current.dir++"\/SCcube.png", 0.03);
width_ (width)
Width of the curve.
width - Default value is 0.1.
l.width_(10)
Examples
...