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?
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hello,
If you need a segment starting from (Xa, Ya, Za) and ending to (Xb, Yb, Zb), then use [curve 2] and set coordinates with two lists of three elements. With this solution, you needn't [rotateXYZ] or [shearXY] objects and can make your segment growing from nothing to the desired length. Have a look at [curve] object. ++
Jack
Le 18/12/2012 13:17, Jack a écrit :
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hello,
If you need a segment starting from (Xa, Ya, Za) and ending to (Xb, Yb, Zb), then use [curve 2] and set coordinates with two lists of three elements. With this solution, you needn't [rotateXYZ] or [shearXY] objects and can make your segment growing from nothing to the desired length. Have a look at [curve] object. ++
Jack
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
I forget to add : with [curve 2], maybe you will need [pol2cart] or [sph2cart] from Zexy lib. ++
Jack
Hi...
A [curve 2] will give you a perfect line. With [cos ] and [sin ] you could "easyly" convert the angle in x, y for the second point...
But, I'm not sure that using a rectangle, in your case, is neither so difficult... Before the rotation, you just have to translate the rectangle of the half of the lenght it grows. It's not a "trick" and works very precisely.
Cheers.
01ivier
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Didn't really notice what [curve]'s argument is for. Thanks guys, I guess that solves it.
On Tue, Dec 18, 2012 at 2:23 PM, Olivier Baudu olivier@labomedia.netwrote:
Hi...
A [curve 2] will give you a perfect line. With [cos ] and [sin ] you could "easyly" convert the angle in x, y for the second point...
But, I'm not sure that using a rectangle, in your case, is neither so difficult... Before the rotation, you just have to translate the rectangle of the half of the lenght it grows. It's not a "trick" and works very precisely.
Cheers.
01ivier
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/**listinfo/pd-listhttp://lists.puredata.info/listinfo/pd-list
-- "On ne peut pas vivre dans un monde où l'on croit que l'élégance exquise du plumage de la pintade est inutile. Ceci est tout à fait à part. J'ai eu envie de le dire, je l'ai dit." Jean Giono, Un roi sans divertissement.
______________________________**_________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/** listinfo/pd-list http://lists.puredata.info/listinfo/pd-list
hello,
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 : gemhead 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.
cheers Cyrille
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thanks Cyrille, this is what I wanted.
On Tue, Dec 18, 2012 at 2:25 PM, Cyrille Henry ch@chnry.net wrote:
hello,
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 : gemhead 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.
cheers Cyrille
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/** listinfo/pd-list http://lists.puredata.info/listinfo/pd-list
hi,
just to notice, I used to use [GEMglBegin] -> [GEMglVertex2d] -> [GEMglVertex2d] -> [GEMglEnd] structure to draw line directly on screen the first GEMglVertex2d is the starting point, the second the end point in conjunction with [gemlist] you can draw line with an arbitrary number of segments which is -- but it's only my point of view -- more convinient than using multiple rectangles (and it's also more efficient because there is no extra point) the line width is set with the [GEMglLineWidth] object... a good example for that is the pix_opencv_countours-help.pd patch which is in pix_opencv (but i know it's not really easy to find it nor to build it but we are currently working to improve that)
best
do it yourself http://antoine.villeret.free.fr http://drii.ensad.fr -- Google lit ce mail... si vous refusez cela, utilisez l'adresse antoine.villeret [at] free.fr pour me contacter
2012/12/18 Alexandros Drymonitis adrcki@gmail.com:
Thanks Cyrille, this is what I wanted.
On Tue, Dec 18, 2012 at 2:25 PM, Cyrille Henry ch@chnry.net wrote:
hello,
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 : gemhead 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.
cheers Cyrille
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Le 18/12/2012 17:10, Antoine Villeret a écrit :
hi,
just to notice, I used to use [GEMglBegin] -> [GEMglVertex2d] -> [GEMglVertex2d] -> [GEMglEnd] structure to draw line directly on screen the first GEMglVertex2d is the starting point, the second the end point in conjunction with [gemlist] you can draw line with an arbitrary number of segments which is -- but it's only my point of view -- more convinient than using multiple rectangles (and it's also more efficient because there is no extra point)
with a message [res 2<, a [curve 2 did not draw extra point. width is change thanks to the width message. cheers c
the line width is set with the [GEMglLineWidth] object... a good example for that is the pix_opencv_countours-help.pd patch which is in pix_opencv (but i know it's not really easy to find it nor to build it but we are currently working to improve that)
best
a
do it yourself http://antoine.villeret.free.fr http://drii.ensad.fr -- Google lit ce mail... si vous refusez cela, utilisez l'adresse antoine.villeret [at] free.fr pour me contacter
2012/12/18 Alexandros Drymonitis adrcki@gmail.com:
Thanks Cyrille, this is what I wanted.
On Tue, Dec 18, 2012 at 2:25 PM, Cyrille Henry ch@chnry.net wrote:
hello,
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 : gemhead 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.
cheers Cyrille
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list