Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
А как рисовать то?ну рисуешь начальную и конечную точку, дополнительные невидимые точки, рядом с которыми должен быть изгиб
График должен представлять собой точку, за которой рисуется линия
private final Minecraft mc = Minecraft.getInstance();
private double linear(double start, double end, double t) {
return start + (end - start) * t;
}
private double elastic(double start, double end, double t) {
double c5 = (2 * Math.PI) / 3;
return (t == 0) ? start : (t == 1) ? end : (Math.pow(2, -10 * t) * Math.sin((t - 0.075) * c5) + end);
}
public void renderGraph() {
List<Vector3d> points = new ArrayList<>();
double start = 0;
double end = 1;
int steps = 100;
for (int i = 0; i <= steps; i++) {
double t = (double) i / steps;
// или так
double y = this.linear(start, end, t);
// или так
double y = this.elastic(start, end, t);
points.add(new Vector3d(t, y, 0));
}
RenderSystem.pushMatrix();
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.lineWidth(2.0F);
GL11.glBegin(GL11.GL_LINE_STRIP);
for (Vector3d point : points) {
GL11.glVertex3d(point.x * 100, point.y * 100, point.z);
}
GL11.glEnd();
RenderSystem.pointSize(5.0F);
GL11.glBegin(GL11.GL_POINTS);
for (Vector3d point : points) {
GL11.glVertex3d(point.x * 100, point.y * 100, point.z);
}
GL11.glEnd();
RenderSystem.enableTexture();
RenderSystem.popMatrix();
}