shapes

Can handle events on irregular shapes on Android?

我与影子孤独终老i 提交于 2019-12-07 16:29:17
问题 As far as I know for now (which is little), all the Views in Android have square or rectangular shapes. This is fine almost all the time until you want - what I actually want - to create non-square shapes that could handle events. My goal is to have a circle divided in 3 sections of 120° each. Each section of the circle should behave like a button. The problem is that if we look at those 3rds of a circle and place them in a square box that strictly contains them, they are overlapping each

Check for overlapping shapes in WPF

断了今生、忘了曾经 提交于 2019-12-07 16:14:08
问题 I have a set of shapes which need to be drawn on top of each other. I need to re-order them such that the smallest shape gets drawn last (i.e. it will be closest to the user). Is there any way to check whether a shape overlappes (encloses and/or intersects) another shape. I know there is a method in Rect structure called Contains which checks whether there is an object within it. Is there a similar method or a way to simulate it on Shapes in WPF? Thanks in advance for any help. Cheers, Nilu

How to make star shape in Java?

半世苍凉 提交于 2019-12-07 04:14:05
问题 I'm trying to make some shapes with Java. I created two rectangles with two different colors but I want to create a star shape and I can't find useful source to help me doing this. Here is my code: import java.awt.*; import javax.swing.*; public class shapes extends JPanel{ @Override public void paintComponent(Graphics GPHCS){ super.paintComponent(GPHCS); GPHCS.setColor(Color.BLUE); GPHCS.fillRect(25,25,100,30); GPHCS.setColor(Color.GRAY); GPHCS.fillRect(25,65,100,30); GPHCS.setColor(new

How do I include System.Windows.Shapes?

夙愿已清 提交于 2019-12-07 02:59:31
问题 I am using Visual Studio 2008 with the .NET Framework (v3.5). I cannot seem to use System.Windows.Shapes, or anything System.Windows.* besides Forms. Here is the link to the class description: System.Windows.Shapes (MSDN Library) Is there some special thing I need to do to use it? I checked in all of the framework folders, and the only dll/xml files I have for System.Windows is System.Windows.Forms. What do I need to do to get this to work? 回答1: This class is part of WPF, from MSDN: Shape

Ideas for generating random lobulated pulmonary nodule contours

时光怂恿深爱的人放手 提交于 2019-12-06 14:32:45
I need to generate random lobulated contours such as the following Any ideas or algorithms on how to do this ?? The software I am going to use is matlab, however I have no problem if you post solutions in other languages too... p.s I only need to plot a random contour that resembles the above... How about this? degree = 5; numPoints = 1000; blobWidth = 5; theta = 0:(2*pi)/(numPoints-1):2*pi; coeffs = rand(degree,1); rho = zeros(size(theta)); for i = 1:degree rho = rho + coeffs(i)*sin(i*theta); end phase = rand*2*pi; [x,y] = pol2cart(theta+phase, rho+blobWidth); plot(x,y) axis equal set(gca,

Canvas rectangle with rounded corners as a progress bar?

社会主义新天地 提交于 2019-12-06 14:13:15
I'm trying to make a progress bar in the form of a rounded rectangle drawn on canvas, this jsfiddle has the shape: http://jsfiddle.net/xT3ax/ this.beginPath(); this.moveTo(x + cornerRadius.upperLeft, y); this.lineTo(x + width - cornerRadius.upperRight, y); this.quadraticCurveTo(x + width, y, x + width, y + cornerRadius.upperRight); this.lineTo(x + width, y + height - cornerRadius.lowerRight); this.quadraticCurveTo(x + width, y + height, x + width - cornerRadius.lowerRight, y + height); this.lineTo(x + cornerRadius.lowerLeft, y + height); this.quadraticCurveTo(x, y + height, x, y + height -

Create random shape/contour using matplotlib

孤街醉人 提交于 2019-12-05 22:52:55
问题 I am trying to generate an image of a random contour using python but I couldn't find an easy way to do it. Here is an example sort of what I want: Initially I tought of doing it using matplotlib and gaussian functions, but I could not even get close to the image I showed. Is there a simple way to do it? I appreciate any help 回答1: matplotlib Path A simple way to achieve random and quite smoothed shapes is using matplotlib.path module. Using a cubic Bézier curve, most of the lines will be

What is the Data value of plus sign in Path

杀马特。学长 韩版系。学妹 提交于 2019-12-05 21:47:34
How to draw plus and minus signs in using data property in Path object. This is my triangle path object. I need to change it to plus symbol. <Path x:Name="trianglePath" Data="M 0 8 H 12 V 15 Z"/> Here, I've created a plus and minus sign which is 10 x 10 pixels using XAML path markup syntax: <Path Margin="10" Stroke="White" Data="M0,5 H10 M5,5 V10Z" StrokeThickness="2" Height="10" Width="10" /> <Path Margin="10" Stroke="White" Data="M0,5 H10" StrokeThickness="2" Height="10" Width="10" /> When experimenting with designing your path drawing, it's helpful to set the path element's height & width

Can handle events on irregular shapes on Android?

时间秒杀一切 提交于 2019-12-05 20:39:28
As far as I know for now (which is little), all the Views in Android have square or rectangular shapes. This is fine almost all the time until you want - what I actually want - to create non-square shapes that could handle events. My goal is to have a circle divided in 3 sections of 120° each. Each section of the circle should behave like a button. The problem is that if we look at those 3rds of a circle and place them in a square box that strictly contains them, they are overlapping each other: not practical to know which the user meant to click... I tried with a custom view in which I drew

Check for overlapping shapes in WPF

人走茶凉 提交于 2019-12-05 18:24:23
I have a set of shapes which need to be drawn on top of each other. I need to re-order them such that the smallest shape gets drawn last (i.e. it will be closest to the user). Is there any way to check whether a shape overlappes (encloses and/or intersects) another shape. I know there is a method in Rect structure called Contains which checks whether there is an object within it. Is there a similar method or a way to simulate it on Shapes in WPF? Thanks in advance for any help. Cheers, Nilu You could probably use the Geometry.FillContainsWithDetail method. Its name is ill-chosen IMHO, but the