/* This file is part of the source code for 3D-XplorMath-J, Version 1.0 (January 2008).
* Copyright (c) 2008 The 3D-XplorMath Consortium (http://3d-xplormath.org).
* This source code is released under a BSD License, which allows redistribution
* in source and binary form, with or without modification, provided copyright
* and license information are included, and with no warranty or guarantee of
* any kind. For details, see http://3d-xplormath.org/j/source/BSDLicense.txt
*/
package vmm3d.surface.parametric;
import java.awt.Color;
import java.awt.event.ActionEvent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import vmm3d.actions.AbstractActionVMM;
import vmm3d.actions.ActionList;
import vmm3d.core.BasicAnimator;
import vmm3d.core.Complex;
import vmm3d.core.I18n;
import vmm3d.core.IntegerParam;
import vmm3d.core.Parameter;
import vmm3d.core.RealParamAnimateable;
import vmm3d.core.View;
import vmm3d.core3D.ComplexVector3D;
import vmm3d.core3D.GridTransformMatrix;
import vmm3d.core3D.Vector3D;
import vmm3d.core3D.View3DLit;
import vmm3d.surface.SurfaceView;
public class LidinoidHfamily extends WeierstrassMinimalSurface {
// This program is presently experimentally. The Lidinoid is not fully understood
private RealParamAnimateable aa = new RealParamAnimateable("vmm3d.surface.parametric.LidinoidHfamily.aa",0.5353,0.3,0.8);
private RealParamAnimateable bb = new RealParamAnimateable("vmm3d.surface.parametric.LidinoidHfamily.bb",0.71399180,0.5,0.9);
//ComplexVector3D[][] integrationGrid;
//boolean needsIntegrationGrid = true;
public LidinoidHfamily() {
super();
addParameter(bb);
bb.setMaximumValueForInput(4.0); // if one wants to morph that far, increase resolution
bb.setMinimumValueForInput(0.0);
addParameter(aa);
aa.setMaximumValueForInput(0.99); // if one wants to morph that far, increase resolution
aa.setMinimumValueForInput(0.01);
setDefaultOrientation(View3DLit.NORMAL_ORIENTATION);
setDefaultViewUp(new Vector3D(-0.52, 0.84, -0.15));
setDefaultViewpoint(new Vector3D(-13, 0.33, 47.4));
setDefaultWindow(-4,4,-3.5,3.1);
uPatchCount.setValueAndDefault(18);
vPatchCount.setValueAndDefault(12);
umin.reset(0.005);
umax.reset(0.9995);
vmin.reset(0.0);
vmax.reset(2.0);
removeParameter(vmin);
removeParameter(vmax);
removeParameter(umin);
removeParameter(umax);
afp.reset(Math.PI/2*0.71399180); //,Math.PI/2*0.681,Math.PI/2*0.772); // for Lidinoid
iFirstInHelper = false;
iBeginMiddleInHelper = true;
// change the next two booleans for testing (or later for education)
wantsToSeeDomain = false;//true;//
wantsToSeeGaussImage = false;//true;//
if (wantsToSeeGaussImage) wantsToSeeDomain = true;
if (wantsToSeeDomain) {setDefaultViewUp(new Vector3D(0,0,1));
setDefaultViewpoint(new Vector3D(0,0,40));}
multipleCopyOptions = new int[] {2,3};
//canShowConjugateSurface = true;
}
private boolean adaptAFP = true; // used in createHelperArray
private double gbranch,a3,scale;
private Vector3D trans, transY, transZ, surf_1, surf_2, surf_3, norm_3;
private GridTransformMatrix Msym;
// ===================================== // =================================== //
public View getDefaultView() {
//SurfaceView view = (SurfaceView)super.getDefaultView(); // its actually a WMSView
WMSView view = new WMSView();
view.setGridSpacing(12);
float c0 = (float)0.2;
//view.getLightSettings().setLight0(new Color(c0,c0,c0));
view.getLightSettings().setAmbientLight(new Color(c0,c0,c0));
//view.getLightSettings().getDirectionalLight2().setItsColor(new Color((float)0.5,(float)1.0,(float)0.0));
//view.getLightSettings().getDirectionalLight2().setItsDirection (new Vector3D(0.66,-0.34,-0.66));
view.getLightSettings ().setSpecularExponent(100);
view.getLightSettings().setSpecularRatio( (float)0.8 );
return view;
}
public void parameterChanged(Parameter param, Object oldValue, Object newValue) {
// overridden to keep state of showConjugateSurfaceToggle in sync with the value of afp.
super.parameterChanged(param, oldValue, newValue);
if (param == afp);
adaptAFP = false; // used in createHelperArray to disallow adaption of AFP to close period.
if (needsValueArray) adaptAFP = true; // always correct AFP if an essential parameter changed
}
protected void createData() {
super.createData(); // helperArray created, flag0 & flag05 are set
data.discardGridTransforms();
computePeriodData();
GridTransformMatrix[] trList = new GridTransformMatrix[64];
trList[0] = new GridTransformMatrix();
// GridTransformMatrix b = new GridTransformMatrix().scale(-1,1,-1).reverse();
GridTransformMatrix Z120 = new GridTransformMatrix().rotateZ(120);
if (!wantsToSeeDomain) {
for (int e=0; e < 2; e++){
trList[1+e] = new GridTransformMatrix(trList[e]).leftMultiplyBy(Z120);
data.addGridTransform(trList[1+e]);
}
for (int e=0; e < 3; e++){
trList[3+e] = new GridTransformMatrix(trList[e]).scale(-1,-1,-1).reverse();
data.addGridTransform(trList[3+e]);
}
trList[6] = new GridTransformMatrix(trList[0]).scale(-1,-1,-1).reverse().translate(surf_1);
data.addGridTransform(trList[6]);
trList[7] = new GridTransformMatrix(trList[4]).scale(-1,-1,-1).reverse().translate(surf_1);
data.addGridTransform(trList[7]);
for (int e=0; e < 4; e++){
trList[8+e] = new GridTransformMatrix(trList[6+e]).leftMultiplyBy(Z120);
data.addGridTransform(trList[8+e]);
}
for (int e=0; e < 6; e++){
trList[12+e] = new GridTransformMatrix(trList[6+e]).scale(-1,-1,-1).reverse();
data.addGridTransform(trList[12+e]);
}
if ((getNumberOfPieces()==2)||(getNumberOfPieces()==3)) {
trList[18] = new GridTransformMatrix(trList[0]).leftMultiplyBy(Msym);
data.addGridTransform(trList[18]);
trList[19] = new GridTransformMatrix(trList[7]).leftMultiplyBy(Msym);
data.addGridTransform(trList[19]);
for (int e=0; e < 4; e++){
trList[20+e] = new GridTransformMatrix(trList[18+e]).leftMultiplyBy(Z120);
data.addGridTransform(trList[20+e]);
}
for (int e=0; e < 6; e++){
trList[24+e] = new GridTransformMatrix(trList[18+e]).scale(-1,-1,-1).reverse();
data.addGridTransform(trList[24+e]);
}
} // if (getNumberOfPieces()==2)
if ((getNumberOfPieces()==3)&&(!inAssociateMorph)) {
trList[30] = new GridTransformMatrix(trList[6]).leftMultiplyBy(Msym);
data.addGridTransform(trList[30]);
trList[31] = new GridTransformMatrix(trList[4]).leftMultiplyBy(Msym);
data.addGridTransform(trList[31]);
//trList[32] = new GridTransformMatrix(trList[2]).leftMultiplyBy(Msym);// further out
for (int e=0; e < 4; e++){
trList[32+e] = new GridTransformMatrix(trList[30+e]).leftMultiplyBy(Z120);
data.addGridTransform(trList[32+e]);
}
} // if (getNumberOfPieces()==3)
} // (!wantsToSeeDomain)
}
public static double paramRescaleEnd(double x){
double y;
y = Math.sin(Math.PI/2*x);
return y;
}
public static double paramRescaleStart(double x){
double y;
y = 1-Math.cos(Math.PI/2*x);
return y;
}
public static double paramRescaleBoth(double x){
double y;
y = (1.0-Math.cos(Math.PI/2*x))/2.0;
return y;
}
// override the default Cartesian Grid
protected Complex domainGrid(double u, double v){
double deps = 1.0/2048.0;
double ph = 0;
double r = 0;
Complex z;
if (u <= 2.0/3.0)
r = gbranch*paramRescaleBoth(3*u);
else if (u<=1)
r = gbranch + (1.0 - gbranch)*paramRescaleStart(3*u-2.0);
ph = 2*Math.PI/3.0*paramRescaleBoth(v);
if (Math.abs(u-2.0/3.0)
Ads help maintain this website.