public static int test_0_stelemref_3() { object [] o = new IFace [1]; o [0] = new Face(); return(0); }
protected override void onDragEnter(object sender, DragDropEventArgs e) { base.onDragEnter(sender, e); TabItem ti = e.DragSource as TabItem; if (ti == null) { return; } if (ti.Parent != null || ti.savedParent == this) { return; } this.AddChild(ti); Point p = ScreenPointToLocal(IFace.Mouse.Position) - Margin; p.X = Math.Max(leftSlope, p.X); p.X = Math.Min(ClientRectangle.Width - rightSlope - TabWidth, p.X); ti.TabOffset = p.X; IFace.ClearDragImage(); }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove(sender, e); mouseLocalPos = e.Position - ScreenCoordinates(Slot).TopLeft - ClientRectangle.TopLeft; updateHoverLine(); if (!IFace.IsDown(MouseButton.Left)) { if (mouseLocalPos.X < leftMargin) { IFace.MouseCursor = MouseCursor.arrow; } else { IFace.MouseCursor = MouseCursor.ibeam; } return; } if (!HasFocus || !buffer.SelectionInProgress) { return; } //mouse is down updateCurrentPosFromMouseLocalPos(); buffer.SetSelEndPos(); }
public TriangleVertexDLE(IFace face, Point3D position, Vector direction) : base(face, position, direction) { this.Illuminance = new Spectrum(); this.GIFaces = new List <TriangleFaceDLE>(); this.IlluminancePacket = new List <Spectrum>(); }
public TriangleFaceDLE(IFace face, IList <RenderPoint> renderPoints) { // TODO: в вершины добавляем направления на которые производится рендеринг как направления ближайших точек рендеринга var p0 = GetNearestRenderPoint(renderPoints, face.Obj.Vertices[face.VertexIndexes[0]]); var p1 = GetNearestRenderPoint(renderPoints, face.Obj.Vertices[face.VertexIndexes[1]]); var p2 = GetNearestRenderPoint(renderPoints, face.Obj.Vertices[face.VertexIndexes[2]]); var vertexes = new Point3D[] { face.Obj.Vertices[face.VertexIndexes[0]], face.Obj.Vertices[face.VertexIndexes[1]], face.Obj.Vertices[face.VertexIndexes[2]], }; var directions = new Vector[] { p0.Direction, p1.Direction, p2.Direction }; this.Vertexes = new TriangleVertexDLE[3]; this.Vertexes[0] = new TriangleVertexDLE(face, vertexes[0], directions[0], this); this.Vertexes[1] = new TriangleVertexDLE(face, vertexes[1], directions[1], this); this.Vertexes[2] = new TriangleVertexDLE(face, vertexes[2], directions[2], this); this.Face = face; this.RenderPoints = renderPoints; }
public static IRubiksCube Clockwise(IRubiksCube cube, IFace face) { return new RubiksCube( getF: coordinate => { if (coordinate.Face.Equals(face)) { return cube[new Coordinate(coordinate.Face, Rotate(coordinate.Position))]; } var direction = face.Diff(coordinate.Face); if (direction != null) { // WTF??? var rotated = Rotate(direction); var before = face.Neighbour(rotated); for (int index = -1; index < 2; index++) { if (coordinate.Position.Equals(face.Matching(direction, index))) { var relative = coordinate.Face.Diff(before); coordinate = coordinate.Travel(ref relative, count: 3); return cube[coordinate]; } } } return cube[coordinate]; }); }
public Intersection(IObj obj, IFace face, float distance, Point3D point) { this.Obj = obj; this.Face = face; this.Distance = distance; this.Point = point; }
public static int Mapping(this IFace view, IDirection direction) { switch (view.Axis) { case Axis.Z: if (view.Orientation == Orientation.Back && direction.Alignment == Alignment.Rows) { return -1; } return +1; case Axis.X: if (view.Orientation == Orientation.Front && direction.Alignment == Alignment.Rows && direction.Delta == Delta.Decrease) { return -1; } if (view.Orientation == Orientation.Back && direction.Alignment == Alignment.Rows && direction.Delta == Delta.Increase) { return -1; } return +1; case Axis.Y: return (view.Orientation == Orientation.Front ? +1 : -1) * (direction.Alignment == Alignment.Rows ? +1 : -1) * direction.Delta.Quantity(); default: throw new ArgumentException(); } }
/// <summary> /// Crop image to face (square) /// </summary> /// Crop an image to the face (rectangular crop). If there is more than one /// face present, choose the first one. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='imageFile'> /// Image file to perform the operation on. Common file formats such as PNG, /// JPEG are supported. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <System.IO.Stream> CropFirstAsync(this IFace operations, System.IO.Stream imageFile, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.CropFirstWithHttpMessagesAsync(imageFile, null, cancellationToken).ConfigureAwait(false); _result.Request.Dispose(); return(_result.Body); }
/// <summary> /// Find faces in an image /// </summary> /// Locate the positions of all faces in an image /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='imageFile'> /// Image file to perform the operation on. Common file formats such as PNG, /// JPEG are supported. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <LocateOKResponse> LocateAsync(this IFace operations, System.IO.Stream imageFile, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.LocateWithHttpMessagesAsync(imageFile, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public static Face Geometry(this IFace face) { if (face?.NodeListIndices == null) { return(null); } if (face.NodeListIndices.Count < 3) { Reflection.Compute.RecordError("Insuffiecient node indices"); return(null); } if (face.NodeListIndices.Count > 4) { Reflection.Compute.RecordError("To high number of node indices. Can only handle triangular and quads"); return(null); } Face geomFace = new Face(); geomFace.A = face.NodeListIndices[0]; geomFace.B = face.NodeListIndices[1]; geomFace.C = face.NodeListIndices[2]; if (face.NodeListIndices.Count == 4) { geomFace.D = face.NodeListIndices[3]; } return(geomFace); }
public CalculationPoint(IFace face, Point3D position, Vector direction) { this.Position = position; this.Obj = face.Obj; this.Face = face; this.Direction = direction; this.Illuminance = new Spectrum(); }
public static Vector3 Center <TVertex>(this IFace <TVertex> face) where TVertex : IVertex { Ensure.That(face, nameof(face)).IsNotNull(); var points = face.Points; return(points.Map(p => p.Position()).Aggregate((p1, p2) => p1 + p2) / points.Count); }
/// <summary> /// Produces a triangular pyramid with 4 faces. /// </summary> /// <param name="sideLength">The length the edges of the triangles should be in pixels.</param> /// <param name="height">The height of the triangle in pixels.</param> public ShapeTriangularPyramid(float sideLength, float height) { SideLength = sideLength; Height = height; // Front is towards you // Back is away from you Vector3 front = new Vector3( 0, sideLength / 2, height / 2 * -1 ); Vector3 backLeft = new Vector3( sideLength / 2, sideLength / 2 * -1, height / 2 * -1 ); Vector3 backRight = new Vector3( sideLength / 2 * -1, sideLength / 2 * -1, height / 2 * -1 ); Vector3 top = new Vector3( 0, 0, height / 2 ); FaceFrontLeft = new FaceTriangle( top, backLeft, front ); FaceFrontRight = new FaceTriangle( top, front, backRight ); FaceBack = new FaceTriangle( top, backLeft, backRight ); FaceBottom = new FaceTriangle( front, backLeft, backRight ); Faces.Add(FaceFrontLeft); Faces.Add(FaceFrontRight); Faces.Add(FaceBack); Faces.Add(FaceBottom); }
public static int test_0_liveness_unbox_trampoline() { var s = new BarStruct(); IFace iface = s; iface.foo(); return(0); }
private Vector3 GetFaceNormal(IFace face) { var v10 = _vertices[face.VertexIndices.ElementAt(1)].Position - _vertices[face.VertexIndices.ElementAt(0)].Position; var v20 = _vertices[face.VertexIndices.ElementAt(2)].Position - _vertices[face.VertexIndices.ElementAt(0)].Position; var cross = Vector3.Cross(v10, v20); cross.Normalize(); return(cross); }
public static int test_1_array_mismatch_3 () { try { object [] o = new IFace [1]; o [0] = 1; return 0; } catch (ArrayTypeMismatchException) { return 1; } }
public WatchFace(IFace face, Bitmap screen = null, ISettings settings = null) { Face = face; if(screen == null) screen = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); if (settings == null) settings = SettingsProvider.Current; Screen = screen; Settings = settings; if (Face.Settings == null) Face.Settings = settings; }
private static bool Check(IFace <object> i) { // We would use type information about the GDV guess here to optimize. if (i.Foo() is IList <int> ) { return(true); } return(false); }
public Client(IPEndPoint serverEnd, IFace fc) { serverEndPoint = serverEnd; face = fc; p2p = new P2P(face, this); Console.Title = "IM Client"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(">You may input 【$h】 for usage!"); }
public IFaceVM() { cmdStart = new RelayCommand((o) => iFace.cmdStart(cmd), o => iFace.isOpen); cmdStop = new RelayCommand((o) => iFace.cmdStop(), o => iFace.isOpen); if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { return; // avoid to open a port in the XAML designer! It will never release it... } iFace = new IFace(); }
public static bool TryParse(string line, out IFace face) { if (Face3.TryParse(line, out face)) { return(true); } if (Face4.TryParse(line, out face)) { return(true); } return(false); }
void onFileSelect(object sender, MouseButtonEventArgs e) { if (string.IsNullOrEmpty(SelectedFile)) { CurrentDirectory = SelectedDirectory; } else { OkClicked.Raise(this, null); IFace.DeleteWidget(this); } }
public bool Equals(IFace face) { for (int i = 0; i < Points.Length; i++) { if (!face.Points[i].Equals(Points[i])) { return(false); } } return(true); }
public static IDirection Diff(this IFace origin, IFace view) { foreach (var direction in Directions()) { if (origin.Neighbour(direction).Equals(view)) { return direction; } } return null; }
public void AddNewPlane(Hyperplane plane, IFace parentFace) { if (_processedPlanes.TryGetValue(plane, out IFace face)) { face.AdjacentCells.Add(parentFace); return; } Face newFace = new Face(plane); newFace.AdjacentCells.Add(parentFace); AddNewFace(newFace); }
protected override void onEndDrag(object sender, DragDropEventArgs e) { base.onEndDrag(sender, e); if (Parent != null) { return; } savedParent.AddChild(this); IFace.ClearDragImage(); }
public override void onMouseDown(object sender, MouseButtonEventArgs e) { if (IFace.IsDown(MouseButton.Right)) { base.onMouseDown(sender, e); return; } SelectedItem = HoverWidget; // if (SelectedItem != null && projFile != null) { // projFile.CurrentLine = SelectedItem.design_line; // projFile.CurrentColumn = SelectedItem.design_column; // } }
public IPv4List() { iplist = new List <IP>(); foreach (var IFace in NetworkInterface.GetAllNetworkInterfaces()) { foreach (var IPInfo in IFace.GetIPProperties().UnicastAddresses) { if (IPInfo.Address.AddressFamily == AddressFamily.InterNetwork && !IPInfo.Address.ToString().StartsWith("127.")) { iplist.Add(new IP(IPInfo.Address, IPInfo.IPv4Mask, IFace.GetPhysicalAddress().ToString())); } } } }
public MFace(IFace face, MObj obj, MVertex[] vertices, MeshSettings meshSettings, MFaceIlluminanceAngles illuminanceAngles) { MeshSettings = meshSettings; Face = face; Obj = obj; Deep = 0; IlluminanceAngles = illuminanceAngles; Vertices = vertices; /* * Vertices = new MVertex[3]; * for( int i = 0; i < 3; i++ ) * Vertices[i] = Obj.Vertices[face.VertexIndexes[i]]; */ }
public static IPosition Opposite(this IFace view, IPosition position) { switch (view.Axis) { case Axis.Z: case Axis.X: return new Position(position.Column.Complement(), position.Row); case Axis.Y: return new Position(position.Column, position.Row.Complement()); default: throw new ArgumentException(); } }
private void RepaintFace(Device device) { if (currentFace == null) { var t = (faces[faceIndex] as Type); try { var ctor = t.GetConstructor(new Type[0]); if (ctor != null) { IFace instance = (ctor.Invoke(new object[0]) as IFace); if (instance != null) { currentFace = instance; } } } catch (Exception) { } } if (currentFace != null) currentFace.RenderFace(device); }
private Vector3 GetFaceNormal(IFace face) { var v10 = _vertices[face.VertexIndices.ElementAt(1)].Position - _vertices[face.VertexIndices.ElementAt(0)].Position; var v20 = _vertices[face.VertexIndices.ElementAt(2)].Position - _vertices[face.VertexIndices.ElementAt(0)].Position; var cross = Vector3.Cross(v10, v20); cross.Normalize(); return cross; }
public void AddFace(IFace face) { _faces.Add(face); }
public Face(IFace f) { a = f.V[0]; b = f.V[1]; c = f.V[2]; }
public static int test_0_stelemref_3 () { object [] o = new IFace [1]; o [0] = new Face (); return 0; }
void OnButtonPress(Buttons button, InterruptPort port, ButtonDirection direction, DateTime time, Device device) { if (button == Buttons.Top) faceIndex--; if (button == Buttons.Bottom) faceIndex++; if (faceIndex < 0) faceIndex = 0; if (faceIndex >= faces.Count) faceIndex = faces.Count-1; Debug.Print(faceIndex.ToString() + ":" + (faces[faceIndex] as Type).FullName); currentFace = null; RepaintFace(device); }
public GameTableContext(IFace.IWindowService service) : this(5, service) { }
public void Connect(IHalfEdge next, IFace face) { Next = next; Face = face; }
public EdgeLoop(IFace face, params IHalfEdge[] edges) { Start = edges[0]; for (var i = 0; i < edges.Length - 1; i++) { edges[i].Connect(edges[i + 1],face); } edges[edges.Length - 1].Connect(Start,face); }