{"id":2916,"date":"2014-09-24T10:35:05","date_gmt":"2014-09-24T09:35:05","guid":{"rendered":"https:\/\/empty3.one\/blogs\/demoniakmachine.com\/?p=2916"},"modified":"2014-09-24T10:35:05","modified_gmt":"2014-09-24T09:35:05","slug":"2916","status":"publish","type":"post","link":"https:\/\/empty3.app\/blog1\/2014\/09\/24\/2916\/","title":{"rendered":"B-Spline Java Code (avec bug)"},"content":{"rendered":"<p>\/**<br \/>\n* *<br \/>\n* Global license :\u00a0 *<br \/>\n* Microsoft Public Licence<br \/>\n*<br \/>\n* author Manuel Dahmen &lt;ibiiztera.it@gmail.com&gt;<br \/>\n*<br \/>\nCreation time 17-sept.-2014<br \/>\n*<br \/>\n**<br \/>\n*\/<br \/>\npackage nurbs;<\/p>\n<p>import be.ibiiztera.md.pmatrix.pushmatrix.Camera;<br \/>\nimport be.ibiiztera.md.pmatrix.pushmatrix.Point3D;<br \/>\nimport be.ibiiztera.md.pmatrix.pushmatrix.nurbs.SurfaceParametriquePolynomialeBezier;<br \/>\nimport be.ibiiztera.md.pmatrix.test.pushmatrix.newtest.TestObjet;<\/p>\n<p>\/**<br \/>\n*<br \/>\n* @author Manuel Dahmen &lt;ibiiztera.it@gmail.com&gt;<br \/>\n*\/<br \/>\npublic class SurfaceBezier extends TestObjet {<\/p>\n<p>@Override<br \/>\npublic void testScene() {<br \/>\nPoint3D[][] p = new Point3D[9][9];<br \/>\nint m = 0;<br \/>\nfor (int i = -4; i &lt;= 4; i++) {<br \/>\nint n = 0;<br \/>\nfor (int j = -4; j &lt;= 4; j++) {<br \/>\np[m][n] = new Point3D(i, j, 0);<br \/>\nn++;<br \/>\n}<br \/>\nm++;<br \/>\n}<br \/>\nSurfaceParametriquePolynomialeBezier surfaceParametriquePolynomialeBezier = new SurfaceParametriquePolynomialeBezier(p);<br \/>\nscene().add(surfaceParametriquePolynomialeBezier);<br \/>\nscene().cameraActive(new Camera(Point3D.Z.mult(-10), Point3D.O0));<\/p>\n<p>}<\/p>\n<p>public static void main(String[] arg) {<br \/>\nSurfaceBezier t1 = new SurfaceBezier();<br \/>\nt1.setGenerate(GENERATE_IMAGE|GENERATE_MODEL);<br \/>\nt1.loop(false);<br \/>\nnew Thread(t1).start();<br \/>\n}<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\/***<br \/>\nGlobal license :<\/p>\n<p>Microsoft Public Licence<\/p>\n<p>author Manuel Dahmen &lt;ibiiztera.it@gmail.com&gt;<\/p>\n<p>Creation time 17-sept.-2014<\/p>\n<p>***\/<br \/>\nIl me semble que le bug doit \u00eatre dans ce fragment:<\/p>\n<p>package be.ibiiztera.md.pmatrix.pushmatrix.nurbs;<\/p>\n<p>import be.ibiiztera.md.pmatrix.pushmatrix.Point3D;<\/p>\n<p>\/**<br \/>\n*<br \/>\n* @author Manuel Dahmen &lt;ibiiztera.it@gmail.com&gt;<br \/>\n*\/<br \/>\npublic class SurfaceParametriquePolynomialeBezier extends ParametrizedSurface<br \/>\n{<br \/>\nprotected final Point3D[][] coefficients;<br \/>\nprotected int power1, power2;<br \/>\npublic SurfaceParametriquePolynomialeBezier(Point3D [][] coefficients)<br \/>\n{<br \/>\nthis.coefficients = coefficients;<br \/>\npower1 = coefficients.length;<br \/>\npower2 = coefficients[0].length;<br \/>\n}<br \/>\nprotected double factorielle(int n)<br \/>\n{<br \/>\ndouble sum = 1;<br \/>\nfor(int i=1 ; i&lt;=n; i++)<br \/>\nsum *= i;<br \/>\nreturn sum;<br \/>\n}<br \/>\npublic double B(int i, int n, double t)<br \/>\n{<br \/>\nreturn<br \/>\nfactorielle(n)\/factorielle(i)\/factorielle(n-i)<br \/>\n*Math.pow(t, i)*Math.pow(1-t, n-i);<br \/>\n}<br \/>\n@Override<br \/>\npublic Point3D calculerPoint3D(double u, double v) {<br \/>\nPoint3D sum = Point3D.O0;<br \/>\nfor(int i=0;i&lt;power1; i++)<br \/>\nfor(int j=0;j&lt;power2; j++)<br \/>\nsum = sum.plus(coefficients[i][j].mult(B(i, power1, u)*B(j, power2, v)));<br \/>\nreturn sum;<br \/>\n}<\/p>\n<p>@Override<br \/>\npublic Point3D calculerVitesse3D(double u, double v) {<br \/>\nthrow new UnsupportedOperationException(\u00ab\u00a0pas encore implant\u00e9\u00a0\u00bb);<br \/>\n}<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/** * * * Global license :\u00a0 * * Microsoft Public Licence * * author Manuel Dahmen &lt;ibiiztera.it@gmail.com&gt; * Creation time 17-sept.-2014 * ** *\/ package nurbs; import be.ibiiztera.md.pmatrix.pushmatrix.Camera; import be.ibiiztera.md.pmatrix.pushmatrix.Point3D; import be.ibiiztera.md.pmatrix.pushmatrix.nurbs.SurfaceParametriquePolynomialeBezier; import be.ibiiztera.md.pmatrix.test.pushmatrix.newtest.TestObjet; \/** * * @author Manuel Dahmen &lt;ibiiztera.it@gmail.com&gt; *\/ public class SurfaceBezier extends TestObjet { @Override public void testScene() { Point3D[][] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2916","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/posts\/2916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/comments?post=2916"}],"version-history":[{"count":0,"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/posts\/2916\/revisions"}],"wp:attachment":[{"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/media?parent=2916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/categories?post=2916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/empty3.app\/blog1\/wp-json\/wp\/v2\/tags?post=2916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}