Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to draw a curve dynamically?

843799Jan 16 2008 — edited Dec 28 2009
here is the code to draw a curve:
Shape3D createcurve(){

    int steps = 720;
    float x = 0.1f;
    Point3f[] coords = new Point3f[steps];
    for (int i = 0; i < coords.length; i++) {
        coords[i] = new Point3f(x,(float)Math.pow(2,x),0.0f);
        x += 0.1f;  
    }
    int[] strip = {steps};
    LineStripArray lsa = new LineStripArray(steps, LineStripArray.COORDINATES, strip);
    lsa.setCoordinates(0, coords);
    Appearance app = new Appearance();
    app.setLineAttributes(new LineAttributes(1.5f, LineAttributes.PATTERN_SOLID, true));

        return new Shape3D(lsa, app);
    }
this curve would be added to the BranchGroup, and show.
but I want to draw it dynamically(not show all the curve in one time)
I don't know how to use the Behavior to do this
PLS help me to do it.
THX

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 25 2010
Added on Jan 16 2008
2 comments
124 views