public Scene GetTransformed(RotateStruct turnKoefs, ScaleStruct scaleKoefs, MoveStruct moveKoefs) { Scene s = new Scene(size); foreach (Object obj in scene) { s.AddModel(obj.Transform(turnKoefs, scaleKoefs, moveKoefs)); } return(s); }
public override Object Transform(RotateStruct turnKoefs, ScaleStruct scaleKoefs, MoveStruct moveKoefs) { Map newMap = new Map(map); Shape shape = new Shape(newMap, col, dh); shape.TurnModel(turnKoefs); shape.ScaleModel(scaleKoefs); shape.MoveModel(moveKoefs); return(shape); }
public static PointInt Transform(int x, int y, int z, RotateStruct koefs) { double x_tmp = x; double y_tmp = y; double z_tmp = z; RotateX(ref y_tmp, ref z_tmp, koefs.tetax); RotateY(ref x_tmp, ref z_tmp, koefs.tetay); RotateZ(ref x_tmp, ref y_tmp, koefs.tetaz); return(new PointInt((int)x_tmp, (int)y_tmp, (int)z_tmp)); }
private void CreateScene_Click(object sender, EventArgs e) { turnKoefs = new RotateStruct(-90, 0, 0); scaleKoefs = new ScaleStruct(1.25, 1.25, 1.25); moveKoefs = new MoveStruct(canvas.Width / 2, canvas.Height / 2 - 150, 0); scene = new Scene(canvas.Size); CreateCloud(); if (CheckGenGround.Checked) { CreateGround(); } SetSun(); HandleSceneChange(); }
private void TurnModel(RotateStruct turnKoefs) { double tetax = turnKoefs.tetax * Math.PI / 180; double tetay = turnKoefs.tetay * Math.PI / 180; double tetaz = turnKoefs.tetaz * Math.PI / 180; double cosTetX = Math.Cos(tetax), sinTetX = Math.Sin(tetax); double cosTetY = Math.Cos(tetay), sinTetY = Math.Sin(tetay); double cosTetZ = Math.Cos(tetaz), sinTetZ = Math.Sin(tetaz); foreach (Polygon pol in polygons) { foreach (PointInt v in pol.GetPointInts()) { Rotation.Transform(ref v.x, ref v.y, ref v.z, cosTetX, sinTetX, cosTetY, sinTetY, cosTetZ, sinTetZ, dh); } } }
public Zbuffer(Scene s, Size size, LightSource sun) { this.size = size; img = new Bitmap(size.Width, size.Height); imgFromSun = new Bitmap(size.Width, size.Height); InitBuffers(); this.sun = sun; turnKoefs = sun.koefs; foreach (Object obj in s.GetModels()) { ProcessObject(Zbuf, img, obj); ProcessObject(ZbufFromSun, imgFromSun, obj.Transform(turnKoefs, new ScaleStruct(1, 1, 1), new MoveStruct(0, 0, 0))); } }
public LightSource(Color color, double tetay, Vector direction) { this.direction = direction; this.color = color; this.koefs = new RotateStruct(90, tetay, 0); }
public abstract Object Transform(RotateStruct turnKoefs, ScaleStruct scaleKoefs, MoveStruct moveKoefs);