If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Is there a easyer/faster way to draw 64 point from an array
5 posts
• Page 1 of 1
Is there a easyer/faster way to draw 64 point from an array
Is there a faster or easyer way to draw a 64 point curve ?
This is working ok but I think there must be a better way.
This was one of my trials ( )
This is working ok but I think there must be a better way.
- Code: Select all
v.drawCurve p_ch2,[
[ 10 , @c[0 ]] ,
[ 15 , @c[1 ]] ,
[ 20 , @c[2 ]] ,
[ 25 , @c[3 ]] ,
[ 30 , @c[4 ]] ,
[ 35 , @c[5 ]] ,
[ 40 , @c[6 ]] ,
[ 45 , @c[7 ]] ,
[ 50 , @c[8 ]] ,
[ 55 , @c[9 ]] ,
[ 60 , @c[10]] ,
[ 65 , @c[11]] ,
[ 70 , @c[12]] ,
[ 75 , @c[13]] ,
[ 80 , @c[14]] ,
[ 85 , @c[15]] ,
[ 90 , @c[16]] ,
[ 95 , @c[17]] ,
[ 100 , @c[18]] ,
[ 105 , @c[19]] ,
[ 110 , @c[20]] ,
[ 115 , @c[21]] ,
[ 120 , @c[22]] ,
[ 125 , @c[23]] ,
[ 130 , @c[24]] ,
[ 135 , @c[25]] ,
[ 140 , @c[26]] ,
[ 145 , @c[27]] ,
[ 150 , @c[28]] ,
[ 155 , @c[29]] ,
[ 160 , @c[30]] ,
[ 165 , @c[31]] ,
[ 170 , @c[32]] ,
[ 175 , @c[33]] ,
[ 180 , @c[34]] ,
[ 185 , @c[35]] ,
[ 190 , @c[36]] ,
[ 195 , @c[37]] ,
[ 200 , @c[38]] ,
[ 205 , @c[39]] ,
[ 210 , @c[40]] ,
[ 215 , @c[41]] ,
[ 220 , @c[42]] ,
[ 225 , @c[43]] ,
[ 230 , @c[44]] ,
[ 235 , @c[45]] ,
[ 240 , @c[46]] ,
[ 245 , @c[47]] ,
[ 250 , @c[48]] ,
[ 255 , @c[49]] ,
[ 260 , @c[50]] ,
[ 265 , @c[51]] ,
[ 270 , @c[52]] ,
[ 275 , @c[53]] ,
[ 280 , @c[54]] ,
[ 285 , @c[55]] ,
[ 290 , @c[56]] ,
[ 295 , @c[57]] ,
[ 300 , @c[58]] ,
[ 305 , @c[59]] ,
[ 310 , @c[60]] ,
[ 315 , @c[61]] ,
[ 320 , @c[62]] ,
[ 325 , @c[63]] ,
This was one of my trials ( )
- Code: Select all
count = 0
pointer = 0
v.drawCurve p_ch3,[
while count < 64
[ @pointer +=10 , @c[count +=1]],
end
]
- rob.keij
- Posts: 13
- Joined: Mon May 25, 2015 9:23 pm
- Location: IJmuiden the Netherlands
Re: Is there a easyer/faster way to draw 64 point from an ar
maybe something along this:
not tested... just guessed
- Code: Select all
v.drawCurve(p_ch2, @c.map.with_index { |x,i| [i*5+10, x] })
not tested... just guessed
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Is there a easyer/faster way to draw 64 point from an ar
Myco,
It works
I do my best to know more about the ruby posibilities but you are very fast in answering....
When do I receive your invoice?
It works
I do my best to know more about the ruby posibilities but you are very fast in answering....
When do I receive your invoice?
- rob.keij
- Posts: 13
- Joined: Mon May 25, 2015 9:23 pm
- Location: IJmuiden the Netherlands
Re: Is there a easyer/faster way to draw 64 point from an ar
rob.keij wrote:When do I receive your invoice?
No invoice, but I accept PayPal donations
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Is there a easyer/faster way to draw 64 point from an ar
x seems to be a fixed list of values. If that's right, you can also create that list elsewhere (for example in init-method) and for drawing just call
v.drawCurve(p_ch2, @x_list.zip(@c))
where @x_list is your array of x-positions. This is faster than mapping, because you don't need to calculate the x-values on each redraw.
v.drawCurve(p_ch2, @x_list.zip(@c))
where @x_list is your array of x-positions. This is faster than mapping, because you don't need to calculate the x-values on each redraw.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 89 guests