Support

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

How to get accurate mouse capture values

For general discussion related FlowStone

Re: How to get accurate mouse capture values

Postby billv » Fri Nov 21, 2014 7:20 pm

Thanks tulamide.
The code was KG's, and still is a bit tricky for me, even though its very small.
Thanks for breaking down KG's code and explaining it.
Your fix should get my On/off matrix trigger working properly..
Hopefully I can work out why it dosn't work on the Y axis, and modify it further,
and then I can fix all the parts I've made in the last few months.
Cheers.. :D
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: How to get accurate mouse capture values

Postby tulamide » Fri Nov 21, 2014 8:30 pm

You're welcome :)

billv wrote:Hopefully I can work out why it dosn't work on the Y axis

Because the code is just measuring the horizontal distance. If you want it to work just like a paintbrush on all axes, you instead would need to calculate distance and angle and then fill by interpolating on that line.

Luckily I've already done all of the hard work for you. The spline class can be used as a toolbox only and offers the methods "distance", "angle" and "move_at_angle", which is exactly what you need here. Just have a look at the manual.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: How to get accurate mouse capture values

Postby billv » Sat Nov 22, 2014 6:04 am

tulamide wrote:you instead would need to calculate distance and angle and then fill by interpolating on that line.

Thanks tulamide. Tried that and finally got the result I'm after.:D
tulamide wrote:The spline class

Yeh, I took a look last week.....and got lost in the "depth" of all the info provided...
I still need to take time to learn it step by step...
tulamide wrote:offers the methods "distance", "angle" and "move_at_angle", which is exactly what you need here

Does that mean i could write the "accurate mouse capture" into the Spline Class, so
i can just forget about adding everywhere..?
or should that be "Mouse" class... :? (noob class confusion)

Ideally I'd like to "bury" this "accurate mouse capture" code so i could just start any
ruby mouse capture like normal ..
def mousemovecaptured x,y
end

..and go from there....
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: How to get accurate mouse capture values

Postby tulamide » Sat Nov 22, 2014 10:49 am

billv wrote:Thanks tulamide. Tried that and finally got the result I'm after.:D

Cool! The results will be interesting (like your painting canvas).

billv wrote:Yeh, I took a look last week.....and got lost in the "depth" of all the info provided...
I still need to take time to learn it step by step...

Do you think I provided too much information when describing the methods, or do I presume too much? My goal was to provide it in a way that those already tried using Ruby are experienced enough to follow the descriptions. Maybe I demand too much?

billv wrote:Does that mean i could write the "accurate mouse capture" into the Spline Class, so
i can just forget about adding everywhere..?
or should that be "Mouse" class... :? (noob class confusion)

Not neccessarily. The thing with classes is this: You can access any class by another class, as long as the first one is defined before accessing it. You can extend any class even after its initial definition. And you can access a class from any ruby edit instance (in other words, the Ruby editor also is just another class), as long as that class is defined before accessing it. For the latter you just need to make sure that the Ruby editor code containing the class definition is interpreted before the Ruby editor that makes use of the class. Flowstone reads layer by layer, following the creation time of each element within a layer. So, if you insert a Ruby editor in your schematic followed by a insertion of a knob, the Ruby editor will be interpreted first. Now, if you want it to be interpreted last, you could either cut and paste it, or put it in a module, because you create the module now, after the knob, so all of its content is also interpreted after the knob.

Having said that, the easiest way would indeed by to create a class holding all methods for calculating the delta movement, and then just call that methods within the usual mouse up, down and captured methods.

To answer the initial question: Yes, it would also be possible to write those methods into the spline class, but it would be better maintainable if they reside in their own class structure.


billv wrote:Ideally I'd like to "bury" this "accurate mouse capture" code so i could just start any
ruby mouse capture like normal ..
def mousemovecaptured x,y
end

..and go from there....

If you mean finding a way to later just call mouseMoveCaptured and the interpolation calculation is done automatically, that's not possible. But you could do what's described above.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: How to get accurate mouse capture values

Postby billv » Sat Nov 22, 2014 12:02 pm

tulamide wrote:Do you think I provided too much information when describing the methods, or do I presume too much?

No mate...the depth of it is awesome..that's not the issue...
I'm just a bit dumb, and can't get the "gist" of it all with a glance or two...
The manual looks and reads really well, and you've broken everything down
so it will be very easy to go step by step...when I find the time to devote to it....all good.
tulamide wrote:The thing with classes

Lots to think about....Thanks for info/advice...
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 102 guests