public void drawMirrors(Graphics g, Color color, int x0, int y0) { for (int i = 0; i < mirrors.Count; i++) { Mirror mir = (Mirror)mirrors[i]; mir.draw(g, color, x0, y0); } }
private void MakeMirrors() { Mirror[] mirrors = new Mirror[3]; int w = this.Width; int h = this.Height; int x0 = w / 2; int y0 = h / 2; int r = w / 6; double px1 = x0 + r * Math.Cos(0); double py1 = y0 + r * Math.Sin(0); double px2 = x0 + r * Math.Cos(Math.PI * 2 / 3); double py2 = y0 + r * Math.Sin(Math.PI * 2 / 3); double px3 = x0 + r * Math.Cos(Math.PI * 4 / 3); double py3 = y0 + r * Math.Sin(Math.PI * 4 / 3); mirrors[0] = Mirror.fromTwoPoint(px1, py1, px2, py2); mirrors[1] = Mirror.fromTwoPoint(px3, py3, px2, py2); mirrors[2] = Mirror.fromTwoPoint(px3, py3, px1, py1); for (int i = 0; i < mirrors.Length; i++) { kaleido.addMirror(mirrors[i]); } }
public ArrayList getPicInMirrors(int step) { if (step <= 0) { return(null); } //int n=picInMirrorSerial.Count; //if( step<=n ) return (ArrayList)picInMirrorSerial[ step]; //???? picInMirrorSerial.Clear(); if (picObjects == null) { return(null); } picInMirrorSerial.Add(picObjects); //picObjects as the first serial ArrayList lastStep = picObjects; for (int i = 1; i <= step; i++) { ArrayList thisStep = new ArrayList(); for (int j = 0; j < lastStep.Count; j++) { PicObject pic = (PicObject)lastStep[j]; for (int k = 0; k < mirrors.Count; k++) { Mirror mir = (Mirror)(mirrors[k]); if (pic.mirror != mir) { thisStep.Add(mir.picObjectMirrorSymmetry(pic)); } } } picInMirrorSerial.Add(thisStep); lastStep = thisStep; } return(lastStep); }
public void addMirror(Mirror m) { mirrors.Add(m); }