one.empty3.library.core.nurbs.TestNurbsSimple1 Maven / Gradle / Ivy
Show all versions of empty3-library-3d Show documentation
/*
* Copyright (c) 2023. Manuel Daniel Dahmen
*
*
* Copyright 2012-2023 Manuel Daniel Dahmen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*__
* *
* Global license : * Microsoft Public Licence
*
* author Manuel Dahmen [email protected]_
*
* *
*/
package one.empty3.library.core.nurbs;
import one.empty3.library.Camera;
import one.empty3.library.Point3D;
import one.empty3.library.TextureCol;
import one.empty3.library.core.testing.TestObjetSub;
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/*__
* @author Manuel Dahmen [email protected]_
*/
public class TestNurbsSimple1 extends TestObjetSub {
public static void main(String[] args) {
TestNurbsSimple1 n = new TestNurbsSimple1();
n.setGenerate(GENERATE_MODEL | GENERATE_IMAGE);
n.setMaxFrames(1);
n.loop(true);
new Thread(n).start();
}
@Override
public void testScene() throws Exception {
scene().getObjets().getData1d().clear();
NurbsSurface1 n = new NurbsSurface1();
n.setMaillage(new Point3D[][]{{
new Point3D(-15.0, 0.0, 15.0),
new Point3D(-15.0, 5.0, 5.0),
new Point3D(-15.0, 5.0, -5.0),
new Point3D(-15.0, 0.0, -15.0)
}, {
new Point3D(-5.0, 5.0, 15.0),
new Point3D(-5.0, 10.0, 5.0),
new Point3D(-5.0, 10.0, -5.0),
new Point3D(-5.0, 5.0, -15.0)
}, {
new Point3D(5.0, 5.0, 15.0),
new Point3D(5.0, 10.0, 5.0),
new Point3D(5.0, 10.0, -5.0),
new Point3D(5.0, 0.0, -15.0)
}, {
new Point3D(15.0, 0.0, 15.0),
new Point3D(15.0, 5.0, 5.0),
new Point3D(15.0, 5.0, -5.0),
new Point3D(15.0, 0.0, -15.0)
}
}, new double[][]{{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}});
/* n.setMaillage(new Point3D[][]{
{
new Point3D(-1, -1, 0),
new Point3D(-1, 1, 0)
},
{
new Point3D(1, -1, 0),
new Point3D(1, 1, 0)}
}
,
new double[][]{
{1, 1},
{1, 1}
});
*/
n.setDegreU(3);
n.setDegreV(3);
n.setReseauFonction(new double[][]{
{0, 0, 0, 0, 1, 1, 1, 1},
{0, 0, 0, 0, 1, 1, 1, 1}
});
n.texture(new TextureCol(Color.WHITE));
n.creerNurbs();
n.setMaxX(5);
n.setMaxY(5);
scene().add(n);
Logger.getAnonymousLogger().log(Level.INFO, ""+n);
scene().cameraActive(new Camera(Point3D.Z.mult(-1000d), Point3D.O0));
}
@Override
public void finit() {
}
@Override
public void ginit() {
}
}