当 Y 为 100 时,曲线的最大高度将为 (+/-) 60。当我有曲线的最大高度时,我需要一种方法来计算 Y。
法典:
点 1 和点 2 具有 x、y 和 z 坐标
this.drawLine = function(point1, point2) {
context = this.getContext();
context.beginPath();
context.moveTo(this.getX(point1), this.getY(point1));
point3 = {
x: ( point1.x + point2.x ) / 2,
y: ( point1.y + point2.y ) / 2,
z: ( point1.z + point2.z ) / 2
}
context.quadraticCurveTo( this.getX(point3), this.getY(point3) + point3.z * 0, this.getX(point2), this.getY(point2));
context.stroke();
}
我需要曲线的线命中 point3 的坐标,而不是它没有到达坐标。
仍然有许多可能的曲线具有相同的最大值。因此,不能隔离单个曲线来计算 Y 值。
我建议找到一种方法来获取有关曲线的更多信息,例如点,属性或关系。
查看以下链接:http://www.personal.kent.edu/~bosikiew/Algebra-handouts/quad-extval.pdfhttp://hotmath.com/hotmath_help/topics/graphing-quadratic-equations-using-transformations.html
找到我的答案:这里
this.drawLine = function(point1, point2, style) {
context = this.getContext();
context.beginPath();
context.moveTo(this.getX(point1), this.getY(point1));
point3 = {
x: ( point1.x + point2.x ) / 2,
y: ( point1.y + point2.y ) / 2,
z: ( point1.z + point2.z ) / 2
}
context.strokeStyle = style;
x = this.getX(point3) * 2 - ( this.getX(point1) + this.getX(point2) ) / 2;
y = this.getY(point3) * 2 - ( this.getY(point1) + this.getY(point2) ) / 2;
context.quadraticCurveTo( x, y, this.getX(point2), this.getY(point2));
context.stroke();
}