/// <summary> /// Updates the group boundary based on the nodes / notes selection. /// </summary> internal void UpdateBoundaryFromSelection() { var selectedModelsList = nodes.ToList(); if (selectedModelsList.Any()) { var groupModels = selectedModelsList.OrderBy(x => x.X).ToList(); //Shifting x by 10 and y to the height of textblock var regionX = groupModels.Min(x => x.X) - ExtendSize; //Increase the Y value by 10. This provides the extra space between // a model and textbox. Otherwise there will be some overlap var regionY = groupModels.Min(y => y.Y) - ExtendSize - (TextBlockHeight == 0.0 ? MinTextHeight : TextBlockHeight); //calculates the distance between the nodes var xDistance = groupModels.Max(x => (x.X + x.Width)) - regionX; var yDistance = groupModels.Max(x => (x.Y + x.Height)) - regionY; // InitialTop is to store the Y value without the Textblock height this.InitialTop = groupModels.Min(y => y.Y); var region = new Rect2D { X = regionX, Y = regionY, Width = xDistance + ExtendSize, Height = yDistance + ExtendSize + ExtendYHeight }; this.X = region.X; this.Y = region.Y; this.Width = Math.Max(region.Width, TextMaxWidth + ExtendSize); this.Height = region.Height; //Initial Height is to store the Actual height of the group. //that is the height should be the initial height without the textblock height. if (this.InitialHeight <= 0.0) { this.InitialHeight = region.Height; } } else { this.Width = 0; this.height = 0; } }
// Generate the points for a star. private static Point2D[] MakeStarPoints(double start_theta, int num_points, int skip, Rect2D rect) { double theta, dtheta; Point2D[] result; double cx = rect.X + rect.Width / 2.0; double cy = rect.Y + rect.Height / 2.0; double rx = rect.Width / 2.0; double ry = rect.Height / 2.0; // If this is a polygon, don't bother with concave points. if (skip == 1) { result = new Point2D[num_points]; theta = start_theta; dtheta = 2 * Math.PI / num_points; for (int i = 0; i < num_points; i++) { result[i] = new Point2D( (float)(cx + rx * Math.Cos(theta)), (float)(cy + ry * Math.Sin(theta))); theta += dtheta; } return(result); } // Find the radius for the concave vertices. double concave_radius = CalculateConcaveRadius(num_points, skip); // Make the points. result = new Point2D[2 * num_points]; theta = start_theta; dtheta = -Math.PI / num_points; for (int i = 0; i < num_points; i++) { result[2 * i] = new Point2D( (float)(cx + rx * Math.Cos(theta)), (float)(cy + ry * Math.Sin(theta))); theta += dtheta; result[2 * i + 1] = new Point2D( (float)(cx + rx * Math.Cos(theta) * concave_radius), (float)(cy + ry * Math.Sin(theta) * concave_radius)); theta += dtheta; } return(result); }
/// <summary> /// Query present rectangles for a surface on a physical device. /// <para> /// When using <see /// cref="DeviceGroupPresentModesKhx.DeviceGroupPresentModeLocalMultiDeviceKhx"/>, the /// application may need to know which regions of the surface are used when presenting /// locally on each physical device. /// </para> /// <para> /// Presentation of swapchain images to this surface need only have valid contents in the /// regions returned by this command. /// </para> /// </summary> /// <param name="physicalDevice">The physical device.</param> /// <param name="surface">The surface.</param> /// <returns>An array of <see cref="Rect2D"/> structures.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static Rect2D[] GetPresentRectanglesKhx(this PhysicalDevice physicalDevice, SurfaceKhr surface) { int count; Result result = vkGetPhysicalDevicePresentRectanglesKHX(physicalDevice)(physicalDevice, surface, &count, null); VulkanException.ThrowForInvalidResult(result); var rectangles = new Rect2D[count]; fixed(Rect2D *rectanglesPtr = rectangles) { result = vkGetPhysicalDevicePresentRectanglesKHX(physicalDevice)(physicalDevice, surface, &count, rectanglesPtr); VulkanException.ThrowForInvalidResult(result); return(rectangles); } }
public IDictionary <ModelNodeId, Rect2D> Calculate(IEnumerable <IDiagramNode> nodes, IEnumerable <IDiagramConnector> connectors) { var diagramNodeToLayoutVertexMap = new Map <ModelNodeId, DiagramNodeLayoutVertex>(); var diagramConnectorToLayoutPathMap = new Map <ModelRelationshipId, LayoutPath>(); var layoutVertices = nodes.Select(i => CreateLayoutVertex(i, diagramNodeToLayoutVertexMap)).OrderBy(i => i.DiagramNode.AddedAt).ThenBy(i => i.Name) .ToList(); var layoutPaths = connectors.Select(i => CreateLayoutPath(i, diagramNodeToLayoutVertexMap, diagramConnectorToLayoutPathMap)).ToList(); var relativeLayout = RelativeLayoutCalculator.Calculate(layoutVertices, layoutPaths); var layoutVertexToPointMap = AbsolutePositionCalculator.GetVertexCenters(relativeLayout, HorizontalGap, VerticalGap); return(diagramNodeToLayoutVertexMap.ToDictionary( i => i.Key, i => Rect2D.CreateFromCenterAndSize(layoutVertexToPointMap.Get(i.Value), i.Value.Size))); }
private static bool IsInRegion(Rect2D region, ILocatable locatable, bool fullyEnclosed) { double x0 = locatable.X; double y0 = locatable.Y; if (false == fullyEnclosed) // Cross selection. { var test = new Rect2D(x0, y0, locatable.Width, locatable.Height); return(region.IntersectsWith(test)); } double x1 = x0 + locatable.Width; double y1 = y0 + locatable.Height; return(region.Contains(x0, y0) && region.Contains(x1, y1)); }
private void CheckThatParentsAreCentered(LayoutVertexToPointMap vertexCenters) { foreach (var vertex in ProperLayoutGraph.Vertices) { if (ProperLayoutGraph.HasPrimaryChildren(vertex)) { var childrenBlockRect = ProperLayoutGraph.GetPrimaryChildren(vertex) .Select(i => Rect2D.CreateFromCenterAndSize(vertexCenters.Get(i), i.Size)) .Union(); if (!vertexCenters.Get(vertex).X.IsEqualWithTolerance(childrenBlockRect.Center.X)) { throw new Exception($"{vertex} is not centered to its children."); } } } }
internal void SelectInRegion(Rect2D region, bool isCrossSelect) { bool fullyEnclosed = !isCrossSelect; foreach (NodeModel n in Model.Nodes) { double x0 = n.X; double y0 = n.Y; if (IsInRegion(region, n, fullyEnclosed)) { if (!DynamoSelection.Instance.Selection.Contains(n)) { DynamoSelection.Instance.Selection.Add(n); } } else { if (n.IsSelected) { DynamoSelection.Instance.Selection.Remove(n); } } } foreach (var n in Model.Notes) { double x0 = n.X; double y0 = n.Y; if (IsInRegion(region, n, fullyEnclosed)) { if (!DynamoSelection.Instance.Selection.Contains(n)) { DynamoSelection.Instance.Selection.Add(n); } } else { if (n.IsSelected) { DynamoSelection.Instance.Selection.Remove(n); } } } }
private GroupLayoutInfo CalculateAbsoluteLayoutRecursive( GroupLayoutInfo groupLayoutInfo, Point2D parentTopLeft, Size2D parentPayloadAreaSize, Rect2D parentChildrenAreaRect, double padding) { if (groupLayoutInfo == null) { return(null); } var childTranslateVector = parentTopLeft + new Point2D(0, parentPayloadAreaSize.Height) + new Point2D(padding, padding) + parentChildrenAreaRect.TopLeft; var absoluteBoxLayout = new List <BoxLayoutInfo>(); foreach (var boxLayoutInfo in groupLayoutInfo.Boxes) { var boxTopLeft = boxLayoutInfo.TopLeft + childTranslateVector; var childGroup = CalculateAbsoluteLayoutRecursive( boxLayoutInfo.ChildGroup, boxTopLeft, boxLayoutInfo.PayloadAreaSize, boxLayoutInfo.ChildGroup?.Rect ?? Rect2D.Undefined, _childrenAreaPadding); var absoluteBoxLayoutInfo = new BoxLayoutInfo( boxLayoutInfo.ShapeId, boxTopLeft, boxLayoutInfo.PayloadAreaSize, childGroup?.Rect.Size.WithMargin(_childrenAreaPadding) ?? Size2D.Zero, childGroup); absoluteBoxLayout.Add(absoluteBoxLayoutInfo); } var absoluteLineLayout = groupLayoutInfo.Lines.Select(i => i.Translate(childTranslateVector)); return(new GroupLayoutInfo(absoluteBoxLayout, absoluteLineLayout)); }
public override Vector2 GetCollisionNormal(Vector2 impactPoint, Vector2 impactDirection) { Rect2D rect = GetBounds(); Vector2 bounds = rect.Size * 0.5f; Vector2 center = rect.Origin + bounds; Vector2 p = impactPoint; int offset = 1; bool insideX = center.X - bounds.X + offset < p.X && p.X < center.X + bounds.X - offset; bool insideY = center.Y - bounds.Y + offset < p.Y && p.Y < center.Y + bounds.Y - offset; bool pointInsideRectangle = insideX && insideY; Vector2 normal = -impactDirection; if (pointInsideRectangle) { normal = impactDirection; } else { if (insideX) { if (p.Y < center.Y) { normal = Vector2.Down; } else { normal = Vector2.Up; } } if (insideY) { if (p.X < center.X) { normal = Vector2.Left; } else { normal = Vector2.Right; } } } normal = normal.Normalize(); return(normal); }
public void SetArea(Rect2D rect, Point2D location) { if (rect.IsInvalid) { return; } location = location.Clamp(rect); #warning 相違がある時だけ行う if (true) { _location = location; _area = rect; Reset(); } }
public PhysicalLineGrid2D(Rect2D bounds, Size2D gridSize) { _bounds = bounds; _gridSize = gridSize; var rowCount = (_bounds.Size.Height + (_gridSize.Height - 1)) / _gridSize.Height; var colCount = (_bounds.Size.Width + (_gridSize.Width - 1)) / _gridSize.Width; _objects = new PhysicalLineSet2D <TObject>(); _grid = new PhysicalLineSet2D <TObject> [rowCount, colCount]; for (var row = 0; row < rowCount; row++) { for (var col = 0; col < colCount; col++) { _grid[row, col] = new PhysicalLineSet2D <TObject>(); } } }
public bool DrawRact2D(int handle, Vector2 min, Vector2 max, float y, Color color) { List <Rect2D> rectList; if (!m_rects.TryGetValue(handle, out rectList)) { return(false); } Rect2D rect = new Rect2D(); rect.min = min; rect.max = max; rect.y = y; rect.color = color; rectList.Add(rect); return(true); }
public void IEnumerableVisitsExpectedPoints() { int size = 10; Rect2D r = Rect2D.FromExtents(0, 0, size, size); var points = (from p in r select p).ToList(); for (int x = 0; x < size; ++x) { for (int y = 0; y < size; ++y) { Assert.Contains(new int2(x, y), points); } } Assert.AreEqual(size * size, points.Count); }
/** * Calculates the length of a ray until it intersects with a shape.<br/> * As this class uses the set maximum ray range to speed up this ray casting,<br/> * this function may return {@code double.PositiveInfinity} for a ray that intersects with an obstacle that is further away than the rayRange from the given starting point. * @param ray the ray to be used for ray casting. * @return the length of the ray. */ public double rayCast(Ray2D ray) { double result = double.PositiveInfinity; Rect2D rayBounding = new Rect2D(ray.getStart().getX() - rayRange, ray.getStart().getY() - rayRange, ray.getStart().getX() + rayRange, ray.getStart().getY() + rayRange); for (int i = 0; i < shapes.Size(); ++i) { Rect2D bounding = boundaries.Get(i); if (rayBounding.isInsideBorder(bounding.getLowerLeft()) || rayBounding.isInsideBorder(bounding.getUpperLeft()) || rayBounding.isInsideBorder(bounding.getLowerRight()) || rayBounding.isInsideBorder(bounding.getUpperRight())) { double tmp = shapes.Get(i).rayCast(ray); result = tmp < result ? tmp : result; } } return(result); }
public GtkDrawspace(GraphicsProvider provider, Rect2D subrect) { Provider = provider; _lastPaintTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; _window = new Window("Drawspace"); _window.DeleteEvent += OnWindowDeleteEvent; _window.SetDefaultSize((int)subrect.Size.X, (int)subrect.Size.Y); _window.Move((int)subrect.Position.X, (int)subrect.Position.Y); _skiaView = new SKDrawingArea(); _skiaView.PaintSurface += OnPaintSurface; _skiaView.Show(); _window.Child = _skiaView; TEXTALIGN[(int)IDrawspace.HORIZONTAL_ALIGNMENT.LEFT] = SKTextAlign.Left; TEXTALIGN[(int)IDrawspace.HORIZONTAL_ALIGNMENT.CENTER] = SKTextAlign.Center; TEXTALIGN[(int)IDrawspace.HORIZONTAL_ALIGNMENT.RIGHT] = SKTextAlign.Right; _skiaView.PaintSurface += OnPaintSurface; // init matrix stack _xformStack.Push(SKMatrix.MakeIdentity()); _window.ShowAll(); }
public void testRayCast() { // Static RayCast tests Assert.AreEqual(double.PositiveInfinity, testRect.rayCast(new Ray2D(1.0d, 1.0d, -7.0d, -8.0d)), 0.000005d); Assert.AreEqual(System.Math.Sqrt(2), testRect.rayCast(new Ray2D(2.0d, 3.0d, 3.0d, 4.0d)), 0.000005d); // Serial RayCast tests Rect2D randomRect; Line2D currentSide; Point2D randomPointOnSide; Point2D randomPoint; int i = 100; do { randomRect = new Rect2D(Util.generateRandomDoubleBetween(-1000.0d, 1000.0d), Util.generateRandomDoubleBetween(-1000.0d, 1000.0d), Util.generateRandomDoubleBetween(-1000.0d, 1000.0d), Util.generateRandomDoubleBetween(-1000.0d, 1000.0d)); int j = 50; do { currentSide = new Line2D(randomRect.getUpperLeft(), randomRect.getUpperRight()); randomPointOnSide = currentSide.randomPoint(); randomPoint = new Point2D(Util.generateRandomDoubleBetween(-1000.0d, 1000.0d), Util.generateRandomDoubleBetween(randomPointOnSide.getY(), 1000.0d)); Assert.AreEqual(randomPoint.distance(randomPointOnSide), randomRect.rayCast(new Ray2D(randomPoint, randomPoint.vec(randomPointOnSide))), 0.000005d); currentSide = new Line2D(randomRect.getLowerLeft(), randomRect.getLowerRight()); randomPointOnSide = currentSide.randomPoint(); randomPoint = new Point2D(Util.generateRandomDoubleBetween(-1000.0d, 1000.0d), Util.generateRandomDoubleBetween(-1000.0d, randomPointOnSide.getY())); Assert.AreEqual(randomPoint.distance(randomPointOnSide), randomRect.rayCast(new Ray2D(randomPoint, randomPoint.vec(randomPointOnSide))), 0.000005d); currentSide = new Line2D(randomRect.getLowerLeft(), randomRect.getUpperLeft()); randomPointOnSide = currentSide.randomPoint(); randomPoint = new Point2D(Util.generateRandomDoubleBetween(-1000.0d, randomPointOnSide.getX()), Util.generateRandomDoubleBetween(-1000.0d, 1000.0d)); Assert.AreEqual(randomPoint.distance(randomPointOnSide), randomRect.rayCast(new Ray2D(randomPoint, randomPoint.vec(randomPointOnSide))), 0.000005d); currentSide = new Line2D(randomRect.getLowerRight(), randomRect.getUpperRight()); randomPointOnSide = currentSide.randomPoint(); randomPoint = new Point2D(Util.generateRandomDoubleBetween(randomPointOnSide.getX(), 1000.0d), Util.generateRandomDoubleBetween(-1000.0d, 1000.0d)); Assert.AreEqual(randomPoint.distance(randomPointOnSide), randomRect.rayCast(new Ray2D(randomPoint, randomPoint.vec(randomPointOnSide))), 0.000005d); j -= 1; } while (j > 0); i -= 1; } while (i > 0); }
void RenderTriangle(CommandBuffer cmdBuffer, VertexData vertexData, RenderPass renderPass, Framebuffer framebuffer, Pipeline pipeline, uint width, uint height) { // Set the viewport var viewport = new Viewport(0, 0, width, height, 0, 0); cmdBuffer.SetViewport(0, new[] { viewport }); var renderArea = new Rect2D(new Offset2D(0, 0), new Extent2D(width, height)); var renderPassBegin = new RenderPassBeginInfo(renderPass, framebuffer, renderArea, null); cmdBuffer.BeginRenderPass(renderPassBegin, SubpassContents.Inline); renderPassBegin.Dispose(); cmdBuffer.BindPipeline(PipelineBindPoint.Graphics, pipeline); // Render the triangle cmdBuffer.BindVertexBuffers(0, new[] { vertexData.Buffer }, new DeviceSize[] { 0 }); cmdBuffer.Draw(3, 1, 0, 0); // End the RenderPass cmdBuffer.EndRenderPass(); }
void RenderTexturedQuad(CommandBuffer cmdBuffer, VertexData vertexData, ImageData imageData, PipelineLayout pipelineLayout, DescriptorSet descriptorSet, RenderPass renderPass, Pipeline pipeline, Framebuffer framebuffer, uint width, uint height) { var viewport = new Viewport(0, 0, width, height, 0, 1); cmdBuffer.SetViewport(0, new[] { viewport }); var renderArea = new Rect2D(new Offset2D(0, 0), new Extent2D(width, height)); var renderPassBegin = new RenderPassBeginInfo(renderPass, framebuffer, renderArea, null); cmdBuffer.BeginRenderPass(renderPassBegin, SubpassContents.Inline); renderPassBegin.Dispose(); cmdBuffer.BindDescriptorSets(PipelineBindPoint.Graphics, pipelineLayout, 0, new[] { descriptorSet }, null); cmdBuffer.BindPipeline(PipelineBindPoint.Graphics, pipeline); cmdBuffer.BindVertexBuffers(0, new[] { vertexData.Buffer }, new DeviceSize[] { 0 }); cmdBuffer.BindIndexBuffer(vertexData.IndexBuffer, 0, IndexType.Uint32); cmdBuffer.DrawIndexed((uint)vertexData.Indicies.Length, 1, 0, 0, 1); cmdBuffer.EndRenderPass(); }
/// <summary> /// Updates the group boundary based on the nodes / notes selection. /// </summary> internal void UpdateBoundaryFromSelection() { var selectedModelsList = nodes.ToList(); if (selectedModelsList.Any()) { var groupModels = selectedModelsList.OrderBy(x => x.X).ToList(); //Shifting x by 10 and y to the height of textblock var regionX = groupModels.Min(x => x.X) - ExtendSize; //Increase the Y value by 10. This provides the extra space between // a model and textbox. Otherwise there will be some overlap var regionY = groupModels.Min(y => y.Y) - ExtendSize - (TextBlockHeight == 0.0 ? MinTextHeight : TextBlockHeight); //calculates the distance between the nodes var xDistance = groupModels.Max(x => x.X) - regionX; var yDistance = groupModels.Max(x => x.Y) - regionY; var widthandheight = CalculateWidthAndHeight(); var maxWidth = widthandheight.Item1; var maxHeight = widthandheight.Item2; // InitialTop is to store the Y value without the Textblock height this.InitialTop = groupModels.Min(y => y.Y); var region = new Rect2D { X = regionX, Y = regionY, Width = xDistance + maxWidth + ExtendSize, Height = yDistance + maxHeight + ExtendSize }; this.X = region.X; this.Y = region.Y; this.Width = Math.Max(region.Width, TextMaxWidth + ExtendSize); this.Height = region.Height; //Calculate the boundary if there is any overlap ModelBase overlap = null; foreach (var nodesList in Nodes) { if (!region.Contains(nodesList.Rect)) { overlap = nodesList; if (overlap.Rect.Top < this.X || overlap.Rect.Bottom > region.Bottom) //Overlap in height - increase the region height { if (overlap.Rect.Bottom - region.Bottom > 0) { this.Height += overlap.Rect.Bottom - region.Bottom + ExtendSize + ExtendYHeight; } region.Height = this.Height; } if (overlap.Rect.Left < this.Y || overlap.Rect.Right > region.Right) //Overlap in width - increase the region width { if (overlap.Rect.Right - region.Right > 0) { this.Width += overlap.Rect.Right - region.Right + ExtendSize; } region.Width = this.Width; } } } //Initial Height is to store the Actual height of the group. //that is the height should be the initial height without the textblock height. if (this.InitialHeight <= 0.0) { this.InitialHeight = region.Height; } } else { this.Width = 0; this.height = 0; } }
private void CreateGraphicsPipeline() { // Shader stages var vertShaderCode = System.IO.File.ReadAllBytes("Shaders/vert.spv"); var fragShaderCode = System.IO.File.ReadAllBytes("Shaders/frag.spv"); var vertShaderModule = vkDevice.CreateShaderModule(vertShaderCode); var fragShaderModule = vkDevice.CreateShaderModule(fragShaderCode); var vertShaderStageInfo = new PipelineShaderStageCreateInfo() { Stage = ShaderStageFlags.Vertex, Module = vertShaderModule, Name = "main", }; var fragShaderStageInfo = new PipelineShaderStageCreateInfo() { Stage = ShaderStageFlags.Fragment, Module = fragShaderModule, Name = "main", }; var shaderStages = new PipelineShaderStageCreateInfo[] { vertShaderStageInfo, fragShaderStageInfo }; // VertexInput var vertexInputInfo = new PipelineVertexInputStateCreateInfo() { VertexBindingDescriptionCount = 0, VertexBindingDescriptions = null, VertexAttributeDescriptionCount = 0, VertexAttributeDescriptions = null, }; var inputAssembly = new PipelineInputAssemblyStateCreateInfo() { Topology = PrimitiveTopology.TriangleList, PrimitiveRestartEnable = false, }; var viewport = new Viewport() { X = 0f, Y = 0f, Width = (float)vkSwapChainExtent.Width, Height = (float)vkSwapChainExtent.Height, MinDepth = 0f, MaxDepth = 1f, }; var scissor = new Rect2D() { Offset = new Offset2D() { X = 0, Y = 0 }, Extent = vkSwapChainExtent, }; var viewportState = new PipelineViewportStateCreateInfo() { ViewportCount = 1, Viewports = new Viewport[] { viewport }, ScissorCount = 1, Scissors = new Rect2D[] { scissor }, }; var rasterizer = new PipelineRasterizationStateCreateInfo() { DepthClampEnable = false, RasterizerDiscardEnable = false, PolygonMode = PolygonMode.Fill, LineWidth = 1f, CullMode = CullModeFlags.Back, FrontFace = FrontFace.Clockwise, DepthBiasEnable = false, DepthBiasConstantFactor = 0f, DepthBiasClamp = 0f, DepthBiasSlopeFactor = 0f, }; var multisampling = new PipelineMultisampleStateCreateInfo() { SampleShadingEnable = false, RasterizationSamples = SampleCountFlags.Count1, MinSampleShading = 1f, SampleMask = null, AlphaToCoverageEnable = false, AlphaToOneEnable = false, }; var colorBlendAttachmend = new PipelineColorBlendAttachmentState() { ColorWriteMask = ColorComponentFlags.R | ColorComponentFlags.G | ColorComponentFlags.B | ColorComponentFlags.A, BlendEnable = false, }; var colorBlending = new PipelineColorBlendStateCreateInfo() { LogicOpEnable = false, LogicOp = LogicOp.Copy, Attachments = new PipelineColorBlendAttachmentState[] { colorBlendAttachmend }, BlendConstants = new float[] { 0f, 0f, 0f, 0f }, }; var pipelineLayoutInfo = new PipelineLayoutCreateInfo() { SetLayoutCount = 0, PushConstantRangeCount = 0, }; vkPipelineLayout = vkDevice.CreatePipelineLayout(pipelineLayoutInfo); var pipelineInfo = new GraphicsPipelineCreateInfo() { StageCount = 2, Stages = shaderStages, VertexInputState = vertexInputInfo, InputAssemblyState = inputAssembly, ViewportState = viewportState, RasterizationState = rasterizer, MultisampleState = multisampling, DepthStencilState = null, ColorBlendState = colorBlending, DynamicState = null, Layout = vkPipelineLayout, RenderPass = vkRenderPass, Subpass = 0, BasePipelineHandle = null, BasePipelineIndex = -1, }; vkGraphicsPipeline = vkDevice.CreateGraphicsPipelines(null, new GraphicsPipelineCreateInfo[] { pipelineInfo })[0]; }
public void setUp() { testRect = new Rect2D(3.0d, 4.0d, 5.0d, 8.0d); zeroPoint = new Point2D(0.0d, 0.0d); }
public Rectangle2D(int x, int y, int sizeX, int sizeY, Color4 col) { rect = new Rect2D(x, y, sizeX, sizeY, col); }
public void Center() { var r1 = Rect2D.FromExtents(0, 0, 10, 10); Assert.AreEqual(new int2(5, 5), r1.Center); }
public static int2 GetRandomPoint(this Rect2D rect, Random rand) { return(rand.NextInt2(rect.Min, rect.Max + 1)); }
public abstract Result GetPhysicalDevicePresentRectangles([Count(Count = 0)] PhysicalDevice physicalDevice, [Count(Count = 0)] SurfaceKHR surface, [Count(Count = 0)] ref uint pRectCount, [Count(Computed = "pRectCount"), Flow(FlowDirection.Out)] out Rect2D pRects);
public Rectangle2D(int x, int y, int sizeX, int sizeY, Texture2D tex = null) { rect = new Rect2D(x, y, sizeX, sizeY, tex); }
public virtual bool Intersects(Rect2D bounds) { Rect2D myBounds = GetBounds(); return(myBounds.Intersects(bounds)); }
// Make a star. public static MeshGeometry3D MakeStar(double radius, double thickness, Transform3D transform) { MeshGeometry3D mesh = new MeshGeometry3D(); // Get the points for a 2-D star. const int num_tips = 5; const int skip = 2; Rect2D rect = new Rect2D(-0.25, -0.25, 0.5, 0.5); Point2D[] star_points = MakeStarPoints(Math.PI / 2.0, num_tips, skip, rect); // Convert to 3D points. int num_points = star_points.Length; double z = thickness / 2.0; // Make the star's tips. for (int i0 = 1; i0 < num_points; i0 += skip) { int i1 = (i0 + skip / 2) % num_points; int i2 = (i0 + skip) % num_points; // Front. mesh.AddTriangle( star_points[i0].ToPoint3D(z), star_points[i2].ToPoint3D(z), star_points[i1].ToPoint3D(0)); // Back. mesh.AddTriangle( star_points[i0].ToPoint3D(-z), star_points[i1].ToPoint3D(0), star_points[i2].ToPoint3D(-z)); // Sides. mesh.AddTriangle( star_points[i0].ToPoint3D(z), star_points[i1].ToPoint3D(0), star_points[i0].ToPoint3D(-z)); mesh.AddTriangle( star_points[i2].ToPoint3D(z), star_points[i2].ToPoint3D(-z), star_points[i1].ToPoint3D(0)); } // Make the back face. List <Point3D> face_points = new List <Point3D>(); for (int i0 = 1; i0 < num_points; i0 += skip) { face_points.Add(star_points[i0].ToPoint3D(-z)); } mesh.AddPolygon(face_points.ToArray()); // Make the front face. Point3D[] front_points = face_points.ToArray(); Array.Reverse(front_points); for (int i = 0; i < front_points.Length; i++) { front_points[i].Z = z; } mesh.AddPolygon(front_points); // Transform the mesh's points if desired. if (transform != null) { transform.Transform(mesh); } return(mesh); }
public Rectangle2D(Vector2 pos, int sizeX, int sizeY, Texture2D tex = null) { rect = new Rect2D((int)pos.X, (int)pos.Y, sizeX, sizeY, tex); }
public void Init(ICharMetric cdi) { _color = cdi.BackgroundColor; _rect = cdi.CharRect; _indexOnLine = cdi.IndexEachLine; }