ソースを参照

Minor fix in DrawLineBezier* (#3006)

When `i` starts with `0`, `t` is also `0`, which results in `previous == startPos == current`, this segment is not only redundant, but it also causes division-by-zero since `sqrtf(dx*dx + dy*dy)` is zero.
pull/3014/head
eternalStudent 2年前
committed by GitHub
コミット
8f741d894a
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更2行の追加2行の削除
  1. +2
    -2
      src/rshapes.c

+ 2
- 2
src/rshapes.c ファイルの表示

@ -241,7 +241,7 @@ void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, fl
Vector2 points[2*BEZIER_LINE_DIVISIONS + 2] = { 0 }; Vector2 points[2*BEZIER_LINE_DIVISIONS + 2] = { 0 };
for (int i = 0; i <= BEZIER_LINE_DIVISIONS; i++)
for (int i = 1; i <= BEZIER_LINE_DIVISIONS; i++)
{ {
t = step*i; t = step*i;
float a = powf(1 - t, 2); float a = powf(1 - t, 2);
@ -286,7 +286,7 @@ void DrawLineBezierCubic(Vector2 startPos, Vector2 endPos, Vector2 startControlP
Vector2 points[2*BEZIER_LINE_DIVISIONS + 2] = { 0 }; Vector2 points[2*BEZIER_LINE_DIVISIONS + 2] = { 0 };
for (int i = 0; i <= BEZIER_LINE_DIVISIONS; i++)
for (int i = 1; i <= BEZIER_LINE_DIVISIONS; i++)
{ {
t = step*i; t = step*i;
float a = powf(1 - t, 3); float a = powf(1 - t, 3);

読み込み中…
キャンセル
保存