// Use this for initialization void Start() { calculator = new CalculatorMtr(-5, -5, 5, 5, 0.05f); calculatory = new CalculatorMtr(-5, -5, 5, 5, 0.01f); calculatort = new Calculator4D(-5, -5, -5, 5, 5, 5, 0.05f); cw.init(-5, -5, -5, 5, 5, 5, 0.05f); pi = new ParticleIllustration(system); pi2 = new ParticleIllustration(linesystem, Color.black); GameObject go = GameObject.FindWithTag("InputText"); tm = go.GetComponent <TextMesh>(); calcubase = new Calculator(); Debug.Log(calcubase.calculate("sin(xy)", 1.655f, -3.439f)); Debug.Log(Mathf.Sin(1.655f * (-3.439f))); }
// Use this for initialization void Start() { //float tmp = Mathf.Sin(2.203f*-4.986f); //Debug.Log(tmp); GameObject go = GameObject.FindWithTag("InputText"); tm = go.GetComponent <TextMesh>(); planeMin = GameObject.Find("planeMin"); planeMax = GameObject.Find("planeMax"); planeAvg = GameObject.Find("planeAvg"); planeMin.SetActive(false); planeMax.SetActive(false); planeAvg.SetActive(false); textX = GameObject.Find("TextX").GetComponent <Text>(); textY = GameObject.Find("TextY").GetComponent <Text>(); textZ = GameObject.Find("TextZ").GetComponent <Text>(); calculator = new CalculatorMtr(-meshSize, -meshSize, meshSize, meshSize, 0.1f); calcubase = new Calculator(); gameObject.GetComponent <CalculatorWrapper>().init(-meshSize, -meshSize, -meshSize, meshSize, meshSize, meshSize, 0.1f); //inputM = new Vector3[101][]; //for(int i = 0; i < 101; i++) { // inputM[i] = new Vector3[101]; //} //float tiny = 0.5f; //for(int i = 0; i < 101; i++) { // for(int j = 0; j < 101; j++) { // float tmp_x = i * tiny; // float tmp_z = j * tiny; // Vector3 tmp = new Vector3(tmp_x, calculate(tmp_x, tmp_z), tmp_z); // inputM[i][j] = tmp; // } //} meshRenderer = GeneratedMesh.GetComponent <GenerateMesh>(); //calculateInput(); }
//private float divide(float min, float max, float gap, int slices, int index) { // if (index == slices){ return max; } // float ret=0; // return ret; //} public void init(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, float g) { for (int i = 0; i < threadNum; i++) { calculator4ds.Add(new Calculator4D()); calcuresults.Add(new List <List <List <float> > >()); } xMin = xmin; yMin = ymin; xMax = xmax; yMax = ymax; zMin = zmin; zMax = zmax; gap = g; sampleFreqx = Mathf.RoundToInt((xmax - xmin) / g); sampleFreqy = Mathf.RoundToInt((ymax - ymin) / g); sampleFreqz = Mathf.RoundToInt((zmax - zmin) / g); float xlgap = (xmax - xmin) / calculator4ds.Count; float ylgap = (ymax - ymin) / calculator4ds.Count; float zlgap = (zmax - zmin) / calculator4ds.Count; int gapnum = Mathf.RoundToInt(zlgap / gap); zlgap = Mathf.RoundToInt((float)gapnum) * gap; for (int i = 0; i < calculator4ds.Count; i++) { if (i == calculator4ds.Count - 1) { calculator4ds[i].init(xMin, yMin, zMin + i * zlgap, xMax, yMax, zMax, gap); } else { calculator4ds[i].init(xMin, yMin, zMin + i * zlgap, xMax, yMax, zMin + (i + 1) * zlgap - gap, gap); } } cmtr = new CalculatorMtr(xMin, yMin, xMax, yMax, gap / 10); }