summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/examples/NURBSsphere.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-08 13:46:05 +0000
committerKarl Berry <karl@freefriends.org>2010-06-08 13:46:05 +0000
commita960e44eb527236f39aec81babc0474911a86078 (patch)
tree9950eca71791d90820a80a521a7cc252c0955db5 /Build/source/utils/asymptote/examples/NURBSsphere.asy
parent6443467452320c296faa1f43f0606a9457bd4463 (diff)
asy 1.96
git-svn-id: svn://tug.org/texlive/trunk@18817 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/examples/NURBSsphere.asy')
-rw-r--r--Build/source/utils/asymptote/examples/NURBSsphere.asy70
1 files changed, 42 insertions, 28 deletions
diff --git a/Build/source/utils/asymptote/examples/NURBSsphere.asy b/Build/source/utils/asymptote/examples/NURBSsphere.asy
index d7f0e77321d..5258c9986de 100644
--- a/Build/source/utils/asymptote/examples/NURBSsphere.asy
+++ b/Build/source/utils/asymptote/examples/NURBSsphere.asy
@@ -1,32 +1,46 @@
import three;
-size(400);
+/* Reference:
+@article{Qin97,
+ title={{Representing quadric surfaces using NURBS surfaces}},
+ author={Qin, K.},
+ journal={Journal of Computer Science and Technology},
+ volume={12},
+ number={3},
+ pages={210--216},
+ year={1997},
+ publisher={Springer}
+}
+*/
+
+size(10cm);
currentprojection=perspective(5,4,2,autoadjust=false);
-real[] uknot={0,0,0,1,1,2,2,3,3,4,4,4};
-
-real[] vknot={0,0,0,1,1,2,2,2};
-
-triple[][] P={{(0,0,1),(1,0,1),(1,0,0),(1,0,-1),(0,0,-1)},
- {(0,0,1),(1,1,1),(1,1,0),(1,1,-1),(0,0,-1)},
- {(0,0,1),(0,1,1),(0,1,0),(0,1,-1),(0,0,-1)},
- {(0,0,1),(-1,1,1),(-1,1,0),(-1,1,-1),(0,0,-1)},
- {(0,0,1),(-1,0,1),(-1,0,0),(-1,0,-1),(0,0,-1)},
- {(0,0,1),(-1,-1,1),(-1,-1,0),(-1,-1,-1),(0,0,-1)},
- {(0,0,1),(0,-1,1),(0,-1,0),(0,-1,-1),(0,0,-1)},
- {(0,0,1),(1,-1,1),(1,-1,0),(1,-1,-1),(0,0,-1)},
- {(0,0,1),(1,0,1),(1,0,0),(1,0,-1),(0,0,-1)}};
-
-real[][] weights={
- {1,1,2,1,1},
- {1,1,2,1,1},
- {2,2,4,2,2},
- {1,1,2,1,1},
- {1,1,2,1,1},
- {1,1,2,1,1},
- {2,2,4,2,2},
- {1,1,2,1,1},
- {1,1,2,1,1}
-};
-
-draw(P,uknot,vknot,weights,yellow);
+// udegree=2, vdegree=3, nu=3, nv=4;
+
+real[] W={2/3,1/3,1};
+real[] w={1,1/3,1/3,1};
+
+// 10 distinct control points
+triple[][] P={{(0,0,1),(-2,-2,1),(-2,-2,-1),(0,0,-1)},
+ {(0,0,1),(2,-2,1),(2,-2,-1),(0,0,-1)},
+ {(0,0,1),(2,2,1),(2,2,-1),(0,0,-1)},
+ {(0,0,1),(-2,2,1),(-2,2,-1),(0,0,-1)}};
+
+P.cyclic=true;
+
+real[][] weights=new real[3][4];
+for(int i=0; i < 3; ++i)
+for(int j=0; j < 4; ++j)
+ weights[i][j]=W[i]*w[j];
+
+real[] uknot={0,0,1/3,1/2,1,1};
+real[] vknot={0,0,0,0,1,1,1,1};
+
+int N=1;
+
+for(int k=0; k < N; ++k)
+for(int i=0; i < 4; ++i)
+ draw(shift(k*Z)*P[i:i+3],uknot,vknot,weights,blue);
+
+// draw(unitsphere,red+opacity(0.1));