ユーザ用ツール

サイト用ツール


cgfs:filled_triangles

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
cgfs:filled_triangles [2024/06/13 01:20] freemikancgfs:filled_triangles [2024/07/12 03:19] (現在) freemikan
行 1: 行 1:
-<codeprism lang=cpp el=true css=full>+{{:cgfs:filled_triangles-000.png?400|}} 
 + 
 +<file cpp>
 #include <raylib.h> #include <raylib.h>
  
行 115: 行 117:
     std::copy(x12.begin(), x12.end(), corner);     std::copy(x12.begin(), x12.end(), corner);
  
-    auto x_left = x012; +    auto &x_left = x012; 
-    auto x_right = x02;+    auto &x_right = x02;
     auto m = x012.size() / 2;     auto m = x012.size() / 2;
     if (x02[m] < x012[m]) {     if (x02[m] < x012[m]) {
-        x_left = x02; +        std::swap(x_leftx_right);
-        x_right = x012;+
     }     }
  
     for (int y = i0; y < i2; ++y) {     for (int y = i0; y < i2; ++y) {
-        auto x_begin = static_cast<int>(std::floor(x_left[y - i0])); +        auto x_l = static_cast<int>(std::floor(x_left[y - i0])); 
-        auto x_end = static_cast<int>(std::floor(x_right[y - i0])); +        auto x_r = static_cast<int>(std::floor(x_right[y - i0])); 
-        for (int x = x_begin; x < x_end; ++x) {+        for (int x = x_l; x <= x_r; ++x) {
             PutPixel(x, y, color);             PutPixel(x, y, color);
         }         }
行 154: 行 155:
     }     }
 } }
-</codeprism>+</file>
  
cgfs/filled_triangles.1718209241.txt.gz · 最終更新: 2024/06/13 01:20 by freemikan

特に明示されていない限り、本Wikiの内容は次のライセンスに従います: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki