private List <Coord> GetPickingCoords(Obstacle obstacle, eSide side, int count) { var coords = new List <Coord>(); int x = side == eSide.Left ? obstacle.Position.X - 1 : obstacle.Position.X + obstacle.Area.Width + 1; for (int i = 0; i < count; i++) { var y = obstacle.Position.Y + obstacle.Area.Height / count * i + ((obstacle.Area.Height / count) / 2); coords.Add(new Coord(x, y)); } return(coords); }
public SlicedHose(eSide side, uint subdivs, float scale, Vector3 offset1, Vector3 offset2, bool useDL) : base(useDL) { PrimitiveMode = OpenTK.Graphics.OpenGL.PrimitiveType.Triangles; Vector3 start = Vector3.Zero, end = Vector3.Zero; switch (side) { #region Around X Axis case eSide.BottomRight: start = -Vector3.UnitY; end = Vector3.UnitZ; break; case eSide.TopRight: start = Vector3.UnitZ; end = Vector3.UnitY; break; case eSide.TopLeft: start = Vector3.UnitY; end = -Vector3.UnitZ; break; case eSide.BottomLeft: start = -Vector3.UnitZ; end = -Vector3.UnitY; break; #endregion Around X Axis #region Around Y Axis case eSide.FrontRight: start = Vector3.UnitX; end = Vector3.UnitZ; break; case eSide.BackRight: start = Vector3.UnitZ; end = -Vector3.UnitX; break; case eSide.BackLeft: start = -Vector3.UnitX; end = -Vector3.UnitZ; break; case eSide.FrontLeft: start = -Vector3.UnitZ; end = Vector3.UnitX; break; #endregion Around Y Axis #region Around Z Axis case eSide.FrontBottom: start = -Vector3.UnitY; end = Vector3.UnitX; break; case eSide.BackBottom: start = -Vector3.UnitX; end = -Vector3.UnitY; break; case eSide.BackTop: start = Vector3.UnitY; end = -Vector3.UnitX; break; case eSide.FrontTop: start = Vector3.UnitX; end = Vector3.UnitY; break; #endregion Around Z Axis } Vertex[] temp = new Vertex[2 + subdivs]; double divisor = 1.0 / ((double)temp.Length - 1.0); for (int i = 0; i < temp.Length; i++) { float Multiplier = (float)(i * divisor); Slerp(ref start, ref end, Multiplier, out temp[i].Normal); temp[i].Normal.Normalize(); temp[i].Position = temp[i].Normal; temp[i].Position *= scale; } VertexArray = new Vertex[temp.Length * 2]; IndexArray = new uint[(temp.Length - 1) * 2 * 3]; uint VertexCounter = 0, IndexCounter = 0, QuadCounter = 0; for (int i = 0; i < temp.Length; i++) { VertexArray[VertexCounter + 0].Position = temp[i].Position + offset1; VertexArray[VertexCounter + 1].Position = temp[i].Position + offset2; VertexCounter += 2; if (i < temp.Length - 1) { IndexArray[IndexCounter + 0] = QuadCounter + 0; IndexArray[IndexCounter + 1] = QuadCounter + 1; IndexArray[IndexCounter + 2] = QuadCounter + 2; IndexArray[IndexCounter + 3] = QuadCounter + 2; IndexArray[IndexCounter + 4] = QuadCounter + 1; IndexArray[IndexCounter + 5] = QuadCounter + 3; IndexCounter += 6; QuadCounter += 2; } } }
public SlicedHose( eSide side, uint subdivs, double scale, Vector3d offset1, Vector3d offset2, bool useDL ) : base( useDL ) { PrimitiveMode = OpenTK.Graphics.OpenGL.BeginMode.Triangles; Vector3d start = Vector3d.Zero, end = Vector3d.Zero; double TexCoordStart=0f, TexCoordEnd=0f; switch ( side ) { #region Around X Axis case eSide.BottomRight: start = -Vector3d.UnitY; end = Vector3d.UnitZ; TexCoordStart = 0.0; TexCoordEnd = 0.25; break; case eSide.TopRight: start = Vector3d.UnitZ; end = Vector3d.UnitY; TexCoordStart = 0.25; TexCoordEnd = 0.5; break; case eSide.TopLeft: start = Vector3d.UnitY; end = -Vector3d.UnitZ; TexCoordStart = 0.5; TexCoordEnd = 0.75; break; case eSide.BottomLeft: start = -Vector3d.UnitZ; end = -Vector3d.UnitY; TexCoordStart = 0.75; TexCoordEnd = 1.0; break; #endregion Around X Axis #region Around Y Axis case eSide.FrontRight: start = Vector3d.UnitX; end = Vector3d.UnitZ; TexCoordStart = 0.0; TexCoordEnd = 0.25; break; case eSide.BackRight: start = Vector3d.UnitZ; end = -Vector3d.UnitX; TexCoordStart = 0.25; TexCoordEnd = 0.5; break; case eSide.BackLeft: start = -Vector3d.UnitX; end = -Vector3d.UnitZ; TexCoordStart = 0.5; TexCoordEnd = 0.75; break; case eSide.FrontLeft: start = -Vector3d.UnitZ; end = Vector3d.UnitX; TexCoordStart = 0.75; TexCoordEnd = 1.0; break; #endregion Around Y Axis #region Around Z Axis case eSide.FrontBottom: start = -Vector3d.UnitY; end = Vector3d.UnitX; TexCoordStart = 0.0; TexCoordEnd = 0.25; break; case eSide.BackBottom: start = -Vector3d.UnitX; end = -Vector3d.UnitY; TexCoordStart = 0.25; TexCoordEnd = 0.5; break; case eSide.BackTop: start = Vector3d.UnitY; end = -Vector3d.UnitX; TexCoordStart = 0.5; TexCoordEnd = 0.75; break; case eSide.FrontTop: start = Vector3d.UnitX; end = Vector3d.UnitY; TexCoordStart = 0.75; TexCoordEnd = 1.0; break; #endregion Around Z Axis } VertexT2dN3dV3d[] temp = new VertexT2dN3dV3d[2 + subdivs]; double divisor = 1.0/ ((double)temp.Length-1.0); for ( int i = 0; i < temp.Length; i++ ) { float Multiplier = (float)( i * divisor ); temp[i].TexCoord.X = TexCoordStart * Multiplier + TexCoordEnd * ( 1.0f- Multiplier); Slerp( ref start, ref end, Multiplier, out temp[i].Normal ); temp[i].Normal.Normalize(); temp[i].Position = temp[i].Normal; temp[i].Position *= scale; } VertexArray = new VertexT2dN3dV3d[temp.Length * 2]; IndexArray = new uint[( temp.Length - 1 ) * 2 * 3]; uint VertexCounter = 0, IndexCounter = 0, QuadCounter = 0; for ( int i = 0; i < temp.Length; i++ ) { VertexArray[VertexCounter + 0].TexCoord.X = temp[i].TexCoord.X; VertexArray[VertexCounter + 0].TexCoord.Y = 0.0; VertexArray[VertexCounter + 0].Normal = temp[i].Normal; VertexArray[VertexCounter + 0].Position = temp[i].Position + offset1; VertexArray[VertexCounter + 1].TexCoord.X = temp[i].TexCoord.X; VertexArray[VertexCounter + 1].TexCoord.Y = 1.0; VertexArray[VertexCounter + 1].Normal = temp[i].Normal; VertexArray[VertexCounter + 1].Position = temp[i].Position + offset2; VertexCounter += 2; if ( i < temp.Length - 1 ) { IndexArray[IndexCounter + 0] = QuadCounter + 0; IndexArray[IndexCounter + 1] = QuadCounter + 1; IndexArray[IndexCounter + 2] = QuadCounter + 2; IndexArray[IndexCounter + 3] = QuadCounter + 2; IndexArray[IndexCounter + 4] = QuadCounter + 1; IndexArray[IndexCounter + 5] = QuadCounter + 3; IndexCounter += 6; QuadCounter += 2; } } }
public SlicedHose(eSide side, uint subdivs, double scale, Vector3d offset1, Vector3d offset2) : base( ) { PrimitiveMode = OpenTK.Graphics.OpenGL.BeginMode.Triangles; Vector3d start = Vector3d.Zero, end = Vector3d.Zero; double TexCoordStart = 0f, TexCoordEnd = 0f; switch (side) { #region Around X Axis case eSide.BottomRight: start = -Vector3d.UnitY; end = Vector3d.UnitZ; TexCoordStart = 0.0; TexCoordEnd = 0.25; break; case eSide.TopRight: start = Vector3d.UnitZ; end = Vector3d.UnitY; TexCoordStart = 0.25; TexCoordEnd = 0.5; break; case eSide.TopLeft: start = Vector3d.UnitY; end = -Vector3d.UnitZ; TexCoordStart = 0.5; TexCoordEnd = 0.75; break; case eSide.BottomLeft: start = -Vector3d.UnitZ; end = -Vector3d.UnitY; TexCoordStart = 0.75; TexCoordEnd = 1.0; break; #endregion Around X Axis #region Around Y Axis case eSide.FrontRight: start = Vector3d.UnitX; end = Vector3d.UnitZ; TexCoordStart = 0.0; TexCoordEnd = 0.25; break; case eSide.BackRight: start = Vector3d.UnitZ; end = -Vector3d.UnitX; TexCoordStart = 0.25; TexCoordEnd = 0.5; break; case eSide.BackLeft: start = -Vector3d.UnitX; end = -Vector3d.UnitZ; TexCoordStart = 0.5; TexCoordEnd = 0.75; break; case eSide.FrontLeft: start = -Vector3d.UnitZ; end = Vector3d.UnitX; TexCoordStart = 0.75; TexCoordEnd = 1.0; break; #endregion Around Y Axis #region Around Z Axis case eSide.FrontBottom: start = -Vector3d.UnitY; end = Vector3d.UnitX; TexCoordStart = 0.0; TexCoordEnd = 0.25; break; case eSide.BackBottom: start = -Vector3d.UnitX; end = -Vector3d.UnitY; TexCoordStart = 0.25; TexCoordEnd = 0.5; break; case eSide.BackTop: start = Vector3d.UnitY; end = -Vector3d.UnitX; TexCoordStart = 0.5; TexCoordEnd = 0.75; break; case eSide.FrontTop: start = Vector3d.UnitX; end = Vector3d.UnitY; TexCoordStart = 0.75; TexCoordEnd = 1.0; break; #endregion Around Z Axis } VertexT2dN3dV3d[] temp = new VertexT2dN3dV3d[2 + subdivs]; double divisor = 1.0 / ((double)temp.Length - 1.0); for (int i = 0; i < temp.Length; i++) { float Multiplier = (float)(i * divisor); temp[i].TexCoord.X = TexCoordStart * Multiplier + TexCoordEnd * (1.0f - Multiplier); Slerp(ref start, ref end, Multiplier, out temp[i].Normal); temp[i].Normal.Normalize(); temp[i].Position = temp[i].Normal; temp[i].Position *= scale; } VertexArray = new VertexT2dN3dV3d[temp.Length * 2]; IndexArray = new uint[(temp.Length - 1) * 2 * 3]; uint VertexCounter = 0, IndexCounter = 0, QuadCounter = 0; for (int i = 0; i < temp.Length; i++) { VertexArray[VertexCounter + 0].TexCoord.X = temp[i].TexCoord.X; VertexArray[VertexCounter + 0].TexCoord.Y = 0.0; VertexArray[VertexCounter + 0].Normal = temp[i].Normal; VertexArray[VertexCounter + 0].Position = temp[i].Position + offset1; VertexArray[VertexCounter + 1].TexCoord.X = temp[i].TexCoord.X; VertexArray[VertexCounter + 1].TexCoord.Y = 1.0; VertexArray[VertexCounter + 1].Normal = temp[i].Normal; VertexArray[VertexCounter + 1].Position = temp[i].Position + offset2; VertexCounter += 2; if (i < temp.Length - 1) { IndexArray[IndexCounter + 0] = QuadCounter + 0; IndexArray[IndexCounter + 1] = QuadCounter + 1; IndexArray[IndexCounter + 2] = QuadCounter + 2; IndexArray[IndexCounter + 3] = QuadCounter + 2; IndexArray[IndexCounter + 4] = QuadCounter + 1; IndexArray[IndexCounter + 5] = QuadCounter + 3; IndexCounter += 6; QuadCounter += 2; } } }
public Quote(decimal price, decimal volume, eSide direction) { this.price = price; this.volume =volume; this.direction = direction; }
public void CancelOrders(Security security = null, eSide? direction = null) { //TODO }
public void CancelOrders(eSide? direction = null) { //TODO }
public Order CreateLimitOrder(Portfolio portfolio, Security security, eSide direction, decimal price, decimal volume) { ++_lastUserId; return new Order() { UserID = _lastUserId, Portfolio = portfolio, Security = security, Direction = direction, Type = eOrderType.Limit, Price = price, Volume = volume }; }