[PD] Creating a line in Gem

Cyrille Henry ch at chnry.net
Tue Dec 18 13:25:27 CET 2012


ok, i can see why it's complicated to use rectangle in this situation.
But i did not see the problem of the curve object.

in order to "give this line an angle", i think it's best to use the rotate object than the shear.

computation are not that hard with rectangle if you do it right :
translateXYZ <- give random position
rotateXYZ  <- give Z rotation
scaleXYZ 0 1 1 <- change X scale to grow
translate 0.5 0 0 <- to move the primitive so that it's not center
rectangle 0.5 0.1 <- 0.1 is line width

starting point is given by the initial translate.
ending point is just : starting point + cos(angle)*line length for X coordinate,
replace cos with sin for Y position (be aware that Gem is in deg, while pd is in rad)

but if you prefer having random initial position and random final position, then a [curve 2] object can be more helpful.

see both solution in attachment.


Le 18/12/2012 12:46, Alexandros Drymonitis a écrit :
> Hi all,
> I've been trying to render a line in Gem, so I'm wondering if it's best to use [curve] (which is actually a curve as it indicates), or [rectangle] with a very small x value, so that it looks like a line.
> My problem is that I want to give this line an angle, so I've been using [shearXY] for now. I also want to make the line grow from nothing to the full desired length, but with [rectangle] it will grow from the middle, so in order to make it grow from the starting point to the ending point, you have to give [rectangle] a continuous x,y offset.
> This way it's really hard to determine the starting and ending point of the line. So, If for example the x,y coordinates of the starting and ending point are random, then the angle and length will also be random and you'll have to manipulate three different objects simultaneously ([rectangle], [translate] and [shearXY]), and I'm not sure if I can find the formula for all these calculations.
> Is there an easier technique for this?
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lines.pd
Type: application/puredata
Size: 3586 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20121218/6f148388/attachment.bin>

More information about the Pd-list mailing list