public void Recalculate() { // TODO: Check. Vector vt = new Vector(); vt.FillAsVectorProduction(this.v, this.v_); this.v_.FillAsVectorProduction(vt, this.v); }
public void Draw(Graphics g, int width, int height) { // g.DrawEllipse(Pens.Silver, -World.R, -World.R, 2 * World.R, 2 * World.R); int bx = width >> 1; int by = height >> 1; Entity mainEntity = this.entities [this.mainEntityId]; Vector v = new Vector(); // TODO: Global? TransformationAsQuaternion qMove = new TransformationAsQuaternion(); // TODO: Global? qMove.Fill(mainEntity.v, World.VectorZ); v.Fill(mainEntity.v_); qMove.Transform(v); v.Normilize(); // TODO: Work wrong. // TransformationAsQuaternion qRotate = new TransformationAsQuaternion(); // TODO: Global? // qRotate.Fill(World.VectorZ, v, World.VectorX); Vector direction = new Vector(); // TODO: Global? direction.FillAsVectorProduction(mainEntity.v_, mainEntity.v); direction.Normilize(); v.Fill(direction); qMove.Transform(v); // TODO: Work wrong. qRotate.Transform(v); g.DrawLine(Pens.Black, 0, 0, v.x * World.R, v.y * World.R); for (int i = 0; i < entitiesCount; ++i) { Entity entity = this.entities [i]; if (-bx <= entity.v.x && entity.v.x <= bx && -by <= entity.v.y && entity.v.y <= by) { try { v.Fill(entity.v); qMove.Transform(v); // TODO: Work wrong. qRotate.Transform(v); Color color = i == this.aimEntityId ? Color.Green : Color.Black; Brush brush = new SolidBrush(Color.FromArgb((int)(0.5f * (maxT - minT) * (v.z + 1) + minT), color)); float s = 0.5f * (maxS - minS) * (v.z + 1) + minS; g.FillEllipse(brush, v.x * World.R - 0.5f * s, v.y * World.R - 0.5f * s, s, s); } catch { } } } if (this.isEndTimer <= 0) { this.isEndString = ""; } else { --this.isEndTimer; Font font = new Font(FontFamily.Families[0], 36); SizeF size = g.MeasureString(this.isEndString, font); g.DrawString(this.isEndString, font, Brushes.DeepPink, -size.Width / 2, 0); } }