shapes

Detect if drawing a path is a circle/rectangle in xcode

做~自己de王妃 提交于 2019-11-28 05:10:42
问题 I want to implement a auto complete feature for a drawing app. Once a free hand object is drawn, I want to detect the type of object (circle/rectangle/triangle) and based on the result would want to plot a corresponding object. I have read up a bit about OpenCV but then I would need to convert the user drawing into an image at real time. I am recording the number of points plotted/traced by the touch and also generate a UIBeizerPath of the corresponding path. How do I go about to detecting

How to display a color selector when clicking a button?

折月煮酒 提交于 2019-11-27 22:51:31
问题 I'm making a program that draws some shapes and fills them with color. I need to change the 'line' color, and want the user to be able to select the color. How can I, when clicking a button "Choose Color", have a set of colours appear below the button? Is it possible for the selector to be embedded in the UI below the button (and not pop up in a window)? I want to display a color selector like in Paint. 回答1: Here is a colour selection button class: shows current selected color opens a

svg: generate 'outline path'

柔情痞子 提交于 2019-11-27 21:24:18
I have a set of coordinates that I turn into an svg path (using cubic beziers to make it smooth). When I apply a certain stroke width, I get the following result (the blue dots are my coordinates) What I am interested in is to get a path that runs around the gray shape (like: pick any point on the gray/white border, and round around the shape until you're back at the starting point). How would I go about computing such a path? for reference, this is my svg info: <g> <title>number 3</title> <path d="m238,50c5.67569,-1.01351 11.8327,-3.8229 20.92029,-2.14724c8.68106,0.69732 14.21173,4.90255 18

How do I draw lines using XNA?

拈花ヽ惹草 提交于 2019-11-27 19:15:46
I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted. Can someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the screen? Perhaps with a brief explanation (including the boilerplate)? I'm not a games programmer and I have little XNA experience. My ultimate goal is to draw some lines onto the screen which I will eventually transform with rotations, etc (by hand). However, for this first step.. I need to simply draw the lines! I remember

Shape Detection in python using OpenCV

陌路散爱 提交于 2019-11-27 18:54:12
I'm working on a project in which I use OpenCV to detect shapes and their colors. There are 5 colors (red, green, yellow, blue and white) and 4 shapes (rectangle, star, circle and heart). I've been able to reliably discern the colors and I can detect the shapes when the image used is a drawn image like this using this code. Note, the image is for demonstration only, the range values in my code are not for these colors. import cv2 import numpy as np class Shape(): def __init__(self, color, shape, x, y, approx): self.color = color self.shape = shape self.x = x self.y = y self.approx = approx def

Create a cross shape in CSS

时光怂恿深爱的人放手 提交于 2019-11-27 15:04:07
IS it possible, I know all the following shapes are possible in this link: http://css-tricks.com/examples/ShapesOfCSS/ but cross must be possible too. When I say cross I mean like this: You could achieve something like this with pseudoelements only: http://jsbin.com/upiyoc/1/edit #cross { width: 100px; height: 100px; position: relative; } #cross:before, #cross:after { content: ""; position: absolute; z-index: -1; background: #d00; } #cross:before { left: 50%; width: 30%; margin-left: -15%; height: 100%; } #cross:after { top: 50%; height: 30%; margin-top: -15%; width: 100%; } The size of the

WPF Rectangle does not have a Click event

房东的猫 提交于 2019-11-27 14:32:14
问题 It seems that the WPF Rectangle shape does not have the Click event defined. What am I supposed to use instead? It does have MouseUp, but it's not quite the same behavior. 回答1: If you're not happy with MouseDown and MouseUp , perhaps you could just put the Rectangle in a Button and handle the Button 's Click event? <Button> <Button.Template> <ControlTemplate> <Rectangle .../> </ControlTemplate> </Button.Template> </Button> It really depends with the behavior you're after. Please elaborate if

Generating multidimensional data

一笑奈何 提交于 2019-11-27 14:04:54
问题 Does R have a package for generating random numbers in multi-dimensional space? For example, suppose I want to generate 1000 points inside a cuboid or a sphere. 回答1: Also check out the copula package. This will generate data within a cube/hypercube with uniform margins, but with correlation structures that you set. The generated variables can then be transformed to represent other shapes, but still with relations other than independent. If you want more complex shapes but are happy with

CSS fade out horizontal rule / line styled div effect without images

三世轮回 提交于 2019-11-27 12:42:42
问题 I'm a big fan of minimal use of images and was wondering if anyone had a tactic (or if it's possible) to create this kind of thing with pure static CSS? http://www.flickr.com/photos/jahimandahalf/6780397612/ I'm referring an effect of a line seemingly getting skinnier and fading out and the shadow effect underneath it. I was thinking it might be possible to do a CSS shape trick with it like the triangles: http://css-tricks.com/snippets/css/css-triangle/ Or perhaps with rotation on box-shadow

How to create a DataFrame of random integers with Pandas?

三世轮回 提交于 2019-11-27 10:49:54
I know that if I use randn , import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) gives me what I am looking for, but with elements from a normal distribution. But what if I just wanted random integers? randint works by providing a range, but not an array like randn does. So how do I do this with random integers between some range? Anand S Kumar numpy.random.randint accepts a third argument ( size ) , in which you can specify the size of the output array. You can use this to create your DataFrame - df = pd.DataFrame(np.random.randint(0,100