Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ned flanders

#1
Store successive values in a circular (ring) buffer.

This is like an array of limited size, say 10 entries, into which you store values as you receive them.  Once the buffer fills up (reaches 10 entries), as you add each new entry, the oldest entry is removed.  You can easily implement this with a standard array, and an index which resets to zero every time it reaches the end of the array.

Then, rather than use the jittery output values directly, you push them into the circular buffer, and use the buffer's average value.  I called this a running average, but if the average is over a sliding window of data (as with the ring buffer), then it's a moving average....a very simple way to smooth out jittery data a bit.

https://en.wikipedia.org/wiki/Moving_average
#2
Have you tried a running average, maybe over a sliding window?
#3
Support / Re: Non-uniform scaling
July 19, 2013, 09:51:50 PM
Thanks, makes perfect sense, I forgot about the normals.
#4
Along similar lines, sounds like you might benefit from that "sensor fusion" stuff all the cool kids are talking about.

I've yet to find any APIs for it yet, but I stumbled across some code somewhere that looks promising.

Anyway, here's a link in case you haven't come across this yet:

http://www.youtube.com/watch?v=C7JQ7Rpwn2k
#5
Support / Re: Non-uniform scaling
July 19, 2013, 08:25:07 PM
Well, I got it to work with the following code, in which I need not only non-uniform x-y scaling, but rotation baked in as well:


plane = Primitives.getPlane(1,1);

Matrix scalingMat = new Matrix();
scalingMat.set(0, 0, width);
scalingMat.set(1, 1, height);

Matrix rotMat = plane.getRotationMatrix();
rotMat.rotateX((float)(Math.PI/2f));

scalingMat.matMul(rotMat);

plane.setRotationMatrix(scalingMat);


Let me know if there's an easier/better way for this.
#6
Support / Non-uniform scaling
July 19, 2013, 07:09:08 PM
Hi, noob question, wondering if there's an easy way to do non-uniform scaling, ie, where x,y,z, scaling factors are different.

My immediate need is simply to create a Primitive.Plane, which is of unit size, then scale as needed in the x,y directions.  For example, maybe I'd like a plane twice as wide as high.

Wait...just occurred to me...should I use the rotation matrix, and pass in values on the diagonal?