one.empty3.library.core.tribase.Tubulaire3refined 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 : * GNU GPL v3
*
* author Manuel Dahmen [email protected]_
*
* Creation time 2015-03-25
*
* *
*/
package one.empty3.library.core.tribase;
import one.empty3.library.Matrix33;
import one.empty3.library.Point3D;
import one.empty3.library.Rotation;
import one.empty3.library.StructureMatrix;
import one.empty3.library.core.nurbs.CourbeParametriquePolynomialeBezier;
import one.empty3.library.core.nurbs.FctXY;
import one.empty3.library.core.nurbs.ParametricCurve;
import one.empty3.library.core.nurbs.ParametricSurface;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Tubulaire3refined extends ParametricSurface implements Precomputable {
public double TAN_FCT_INCR = 0.0001;
public double NORM_FCT_INCR = 0.0001;
protected StructureMatrix soulCurve = new StructureMatrix<>(0, CourbeParametriquePolynomialeBezier.class);
protected StructureMatrix diameterFunction = new StructureMatrix<>(0, FctXY.class);
protected Point3D lastNorm;
protected Point3D lastTan = Point3D.Z;
Point3D[][] vecteurs = new Point3D[3][3];
private Point3D[][] pointUV = null;
protected double[] incrUpre;
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) {
vecteurs[i][j] = new Point3D(0., 0., 0.);
for (int k = 0; k < 3; k++)
vecteurs[i][j].set(j, k == i ? 1. : 0.);
}
}
public Tubulaire3refined() {
super();
level = 0;
this.quad_not_computed = QUAD_NOT_COMPUTE_U2|QUAD_NOT_COMPUTE_V2;
soulCurve.setElem(new CourbeParametriquePolynomialeBezier());
diameterFunction.setElem(new FctXY());
declareProperties();
}
public Tubulaire3refined(ParametricCurve lineSegment, FctXY rayonMembres) {
this();
level = 0;
this.quad_not_computed = QUAD_NOT_COMPUTE_U2|QUAD_NOT_COMPUTE_V2;
this.soulCurve.getElem().getCoefficients().setElem(lineSegment.calculerPoint3D(0.0), 0);
this.soulCurve.getElem().getCoefficients().setElem(lineSegment.calculerPoint3D(1.0), 1);
this.diameterFunction.setElem(rayonMembres);
}
public void precompute() {
int sizeU = (int) ((getEndU()-getStartU())/getIncrU());
int sizeV = (int) ((getEndV()-getStartV())/getIncrV());
pointUV = new Point3D[sizeU][sizeV];
incrUpre = new double[sizeU];
for(double u=getStartU(); u= 0 ? (i1 < incrUpre.length ? i1 : incrUpre.length - 1) : 0;
if (indexV < incrUpre.length)
incrUpre[i] = 1.0 * indexV / sizeV;
}
}
}
private int minDist(Point3D point3D, Point3D[] point3DS) {
int indexChoice = -1;
int index = 0;
double valMin = Double.MAX_VALUE;
while(index= 0.00001) {
normal = calculerNormale(t);
if (normal.equals(Point3D.O0) || normal.isAnyNaN() || normal.norme() < 0.8) {
normal = tangente.prodVect(refs[i]);//TODO .prodVect(refs[i])).norme1();
}
}
} else {
normal = lastNorm;
}
if (!normal.equals(Point3D.O0) && !normal.isAnyNaN() && !(normal.norme() < 0.8)) {
lastNorm = normal;
}
normal = normal.norme1();
px = tangente.prodVect(normal);//TODO .prodVect(refs[i])).norme1();
Point3D py = tangente.prodVect(px).norme1();
vecteurs[i][0] = tangente.norme1();
vecteurs[i][1] = px.norme1();
vecteurs[i][2] = py.norme1();
// if(incrUpre==null)
// precompute();
//
// int indexU=0;
// double sumA = 0.0;
// for(double t1=0; t1 0) {
super.calculerPoint3D(v, u);
}
Point3D[] vectPerp = vectPerp(u, v);
int indexU = 0;
for(double t1=getStartU(); t1 getSoulCurve() {
return soulCurve;
}
public StructureMatrix getDiameterFunction() {
return diameterFunction;
}
}