Just in case no one answers: quadratic as in polynomial function? or something more general?
I've noticed a remotely similar problem being discussed recently, but more general:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1137896034
I was definitely interested in this topic from "camera on rail" problem, but this may be applied to your case as well.
If it is specifically for a series of quadratic functions, it'll be relatively easy to create a class that describes the increments along a quadratic curve without above abstractions - it'll only need coefficients and range, and store them in an array.
I should at least ask this before I code away....oh, what the heck, I'll just write a stub:
Code:
ArrayList quadSegments = new ArrayList();
//...
class QuadSegment{
float coeffA, coeffB, coeffC, range1, range2;
QuadSegment(float coeffA, float coeffB, float coeffC, float range1, float range2){
this.coeffA = coeffA;
this.coeffB = coeffB;
this.coeffC = coeffC;
this.range1 = range1;
this.range2 = range2;
}
boolean withinRange(){
// TODO: stub
}
float getY(float x){
// TODO: stub
}
}
By the way, does anyone know how to do list comprehension in Java, for, say, withinRange()?
======edit======
ack, fixed a minor bug. And followed PhiLho's advice and fixed my abuse of class for primitive values (have lots to learn about Java).