This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
「距離」の定義を満たす関数 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqrt(max(abs(p.x)-0.5,0.0) * max(abs(p.x)-0.5,0.0) + max(abs(p.y)-0.5,0.0) * max(abs(p.y)-0.5,0.0) + max(abs(p.z)-0.5,0.0) * max(abs(p.z)-0.5,0.0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
length(max(q - vec3(【x軸方向の長さ】, 【y軸方向の長さ】, 【y軸方向の長さ】), 0.0))) - r | |
r:半径 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec3 d = abs(p) - vec3(0.5, 0.5, 0.5); | |
return min(max(d.x, max(d.y, d.z)), 0.0) + sqrt(max(d.x, 0.0) * max(d.x, 0.0) + max(d.y, 0.0) * max(d.y, 0.0) + max(d.z, 0.0) * max(d.z, 0.0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S(u,v) = | |
\begin{pmatrix} | |
(R + r \cos u) \cos v \\ | |
(R + r \cos u) \sin v \\ | |
r \sin u | |
\end{pmatrix} | |
, (0 \leq u, v \leq 2 \pi), (0 < r < R) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// length使わない方法 | |
float r = 0.3; | |
float R = 1.0; | |
return sqrt(p.x*p.x+p.y*p.y+p.z*p.z + R*R - 2.0 * R * sqrt(p.x*p.x+p.y*p.y) ) - r; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S(u,v) = | |
\begin{pmatrix} | |
(c_x + r \cos u) \\ | |
h \\ | |
(c_z + r \sin u) | |
\end{pmatrix} | |
\\ | |
(0<h,r), h:高さ,r:半径,\\ | |
c_x:円の中心のx座標、c_z:円の中心のz座標 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S(u,v) = | |
\begin{pmatrix} | |
\frac{c_y}{\sqrt{c_x}}v \cos u \\ | |
\frac{c_y}{\sqrt{c_x}}v \sin u \\ | |
v | |
\end{pmatrix} | |
\\ | |
c_x:coneの鋭角度合、c_y:三角錐の半径 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n_{x}x+n_{y}y+n_{z}z=n_{w} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hexagonalの距離関数 | |
vec3 q = abs(p); | |
float radio = 1.0; // 一辺の長さ | |
float hight = 2.0; // 厚さ(高さ) | |
return max(q.z-hight,max((q.x*0.866025+q.y*0.5),q.y)-radio); |
OlderNewer