/*  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 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 SchwarzHsurface extends WeierstrassMinimalSurface {
	
	private RealParamAnimateable aa = new RealParamAnimateable("vmm3d.surface.parametric.SchwarzHsurface.aa",0.538,0.05,0.95);
	//private RealParamAnimateable bb = new RealParamAnimateable("vmm3d.surface.parametric.SchwarzHsurface.bb",0.6,0.52,0.98);
	//ComplexVector3D[][] integrationGrid;
	//boolean needsIntegrationGrid = true;
	
	public SchwarzHsurface() {
		super();
		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.03,  0.87,  0.49));
		setDefaultViewpoint(new Vector3D(11, -24, 42));
		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.setValue(Math.PI/2*0.713); 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};
		canShowConjugateSurface = true;
	}
	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;
	}

	private double gbranch,a3,scale;
	private Vector3D trans, transY, transZ, surf_1, surf_2, surf_3, norm_3;
	private GridTransformMatrix Msym;
	protected double AFPold = 0.0;
	
	public void parameterChanged(Parameter param, Object oldValue, Object newValue) {	
		super.parameterChanged(param, oldValue, newValue);
		     AFP = afp.getValue();
		                 boolean AFPflag = ((param==afp)&&((AFP==0.0)||(AFPold==0.0))); 
		     if ((param != afp)||AFPflag) 
		    	 	needsValueArray = true;
		     AFPold = AFP;
	}
	
	protected void createData() {
        super.createData();     // helperArray created, flag0 & flag05 are set
        computePeriodData();
        data.discardGridTransforms();
        GridTransformMatrix[] trList = new GridTransformMatrix[64];
        		trList[0] = new GridTransformMatrix();
        		GridTransformMatrix a = new GridTransformMatrix().scale(1,1,-1);
        		GridTransformMatrix b = new GridTransformMatrix().scale(-1,1,-1).reverse();
        		GridTransformMatrix Z120 = new GridTransformMatrix().rotateZ(120);
        if (!wantsToSeeDomain)		{ 
        	if (!flag0||inAssociateMorph) {
        	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) {
        		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 (!flag0||inAssociateMorph)
        	
        	else if (flag0){
        		trList[1] = new GridTransformMatrix(trList[0]).leftMultiplyBy(Z120);
        		data.addGridTransform(trList[1]);
        		trList[2] = new GridTransformMatrix(trList[1]).leftMultiplyBy(Z120);
        		data.addGridTransform(trList[2]);
        	for (int e=0; e < 3; e++){
        		trList[3+e] = new GridTransformMatrix(trList[e]).leftMultiplyBy(a).translate(transZ);
        		data.addGridTransform(trList[3+e]); 
        		}
        	for (int e=0; e < 6; e++){
        		trList[6+e] = new GridTransformMatrix(trList[e]).leftMultiplyBy(b).translate(transY);
        		data.addGridTransform(trList[6+e]); 
        		}
        	for (int e=0; e < 6; e++){
        		trList[12+e] = new GridTransformMatrix(trList[6+e]).leftMultiplyBy(Z120);
        		data.addGridTransform(trList[12+e]); 
        		}
     if (getNumberOfPieces()==2) {
        		for (int e=0; e < 6; e++){
            		trList[18+e] = new GridTransformMatrix(trList[12+e]).leftMultiplyBy(Z120);
            		data.addGridTransform(trList[18+e]); 
            		}
        		}
        	} // else
        } // (!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)= vcount-1-jP))      eW.z.assign(ZERO_C);
			if ((i==ucount-1)&&(j > jP))            {eW.assign(ZERO_C, ZERO_C, eW.z); }
			if ((i==ucount-1)&&(j < vcount-1-jP))   { eW.assign(halfPeriod.x, halfPeriod.y, eW.z); } 
			} 
		}
		if (wantsToSeeDomain)     return new Vector3D(eW.z.re, eW.z.im, 0);
		else if (AFP==0)  return eW.re(); 
		else      return (eW.re().times(Math.cos(AFP))).plus((eW.im().times(Math.sin(AFP))));    
	}
	*/   
}



 

Ads help maintain this website.