ellipse

How to calculate the volume of the intersection of ellipses in r

送分小仙女□ 提交于 2019-12-05 22:03:34
I was wondering how to calculate the intersection between two ellipses e.g. the volume of the intersection between versicolor and virginca as illustrated in this graph: which is plotted using the following mwe based on this tutorial : data(iris) log.ir <- log(iris[, 1:4]) ir.species <- iris[, 5] ir.pca <- prcomp(log.ir, center = TRUE, scale. = TRUE) library(ggbiplot) g <- ggbiplot(ir.pca, obs.scale = 1, var.scale = 1, groups = ir.species, ellipse = TRUE, circle = TRUE) g <- g + scale_color_discrete(name = '') g <- g + theme(legend.direction = 'horizontal', legend.position = 'top') print(g) I

Triangle Filling in opencv

跟風遠走 提交于 2019-12-05 13:30:32
We have Rectangle fillings , circle and ellipse filling in opencv, but can anyone say how to fill a triangle in an image using opencv ,python. The simplest solution of filling a triangle shape is using draw contour function in OpenCV. Assuming we know the three points of the triangle as "pt1", "pt2" and "pt3": import cv2 import numpy as np image = np.ones((300, 300, 3), np.uint8) * 255 pt1 = (150, 100) pt2 = (100, 200) pt3 = (200, 200) cv2.circle(image, pt1, 2, (0,0,255), -1) cv2.circle(image, pt2, 2, (0,0,255), -1) cv2.circle(image, pt3, 2, (0,0,255), -1) We can put the three points into an

End the ellipse problem with TextViews

人走茶凉 提交于 2019-12-05 06:47:23
Whoa SDK, whoa... So I'm attempting to add an ellipse to the end of my TextView (single line) before it runs off screen. I've read that ellipses are broke (developing for 2.1)? After Google searching, everyone seems to suggest setting inputType to text and maxLines to 1 and you will get an ellipse. There are two problems with this: 1) The text runs off the screen, but doesn't ellipse. I can tell the text is running off the screen because only a half of a character is showing at the edge of the screen, but it's not printing "..." instead. 2) When I have inputType set on my TextView, clicking my

How to set the layout margins of edit text boxes?

廉价感情. 提交于 2019-12-05 03:40:39
In the table layout i have a tablerow and in that tablerow i have 6 edit text boxes and i want to set the layout margins for that 6 edit text boxes TableLayout t1=(TableLayout)findViewById(R.id.table_layout01); TableRow tr1=new TableRow(inventory.this); tr1.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); tr1.setBackgroundColor(Color.BLACK); EditText ed6=new EditText(inventory.this); //ed6.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); /*ViewGroup.MarginLayoutParams editmargin=new ViewGroup.MarginLayoutParams

Calculating the area of a confidence ellipse in a certain region of space

ぐ巨炮叔叔 提交于 2019-12-05 00:16:53
问题 I was wondering if someone had an idea on how to calculate the blue shaded area inside my confidence ellipse. Any suggestions or places to look are greatly appreciated. Also, I am hoping to find a general formula since the ellipse does not necessarily have to lie in that region in application (i.e., the ellipse could have been bigger). Here is my code for my picture if it helps: library(car) x = c(7,4,1) y = c(4,6,7) plot(x,y,xlim=c(0,10),ylim=c(0,10)) rect(x,y,max(x)+100000,max(y)+100000,col

Qt Ellipse Border Thins Out

送分小仙女□ 提交于 2019-12-04 19:35:17
I am trying to draw an ellipse in Qt and the border on the edges goes thin in some places. Here is the code: QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); painter.setPen(QPen(Qt::black, 3)); painter.drawEllipse(event->rect()); Any ideas? Thanks in advance. When painting a shape with an outline, you have to factor in the width of the pen. So in your case, change to this: // Adjusted by 2 pixels because half your pen width is 1.5, but QRect is // for integer types, so rounded up. painter.drawEllipse(event->rect().adjusted( -2, -2, 2, 2 ) ); 来源: https:/

fit a ellipse in Python given a set of points xi=(xi,yi)

和自甴很熟 提交于 2019-12-04 15:41:53
I am computing a series of index from a 2D points (x,y). One index is the ratio between minor and major axis. To fit the ellipse i am using the following post when i run these function the final results looks strange because the center and the axis length are not in scale with the 2D points center = [ 560415.53298363+0.j 6368878.84576771+0.j] angle of rotation = (-0.0528033467597-5.55111512313e-17j) axes = [0.00000000-557.21553487j 6817.76933256 +0.j] thanks in advance for help import numpy as np from numpy.linalg import eig, inv def fitEllipse(x,y): x = x[:,np.newaxis] y = y[:,np.newaxis] D =

Is there a way to draw a CGContextDrawRadialGradient as an oval instead of a perfect circle?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 11:51:48
问题 I need a radial gradient in the shape of an oval or ellipse and it seems like it CGContextDrawRadialGradient can only draw a perfect circle. I've been drawing to a square context then copying/drawing into a rectangular context. Any better way to do this? Thanks! 回答1: The only way I've found to do this is as Mark F suggested, but I think the answer needs an example to be easier to understand. Draw an elliptical gradient in a view in iOS (and using ARC): - (void)drawRect:(CGRect)rect {

WPF Binding to change fill color of ellipse

梦想与她 提交于 2019-12-04 03:02:50
Probably a simple question but: How do I programmatically change the color of an ellipse that is defined in XAML based on a variable? Everything I've read on binding is based on collections and lists -can't I set it simply (and literally) based on the value of a string variable? string color = "red" color = "#FF0000" It's worth pointing out that the converter the other posts reference already exists , which is why you can do <Ellipse Fill="red"> in xaml in the first place. The converter is System.Windows.Media.BrushConverter : BrushConverter bc = new BrushConverter(); Brush brush = (Brush) bc

How do I draw an ellipse with arbitrary orientation pixel by pixel?

旧时模样 提交于 2019-12-03 12:41:29
I have to draw an ellipse of arbitrary size and orientation pixel by pixel. It seems pretty easy to draw an ellipse whose major and minor axes align with the x and y axes, but rotating the ellipse by an arbitrary angle seems trickier. Initially I though it might work to draw the unrotated ellipse and apply a rotation matrix to each point, but it seems as though that could cause errors do to rounding, and I need rather high precision. Is my suspicion about this method correct? How could I accomplish this task more precisely? I'm programming in C++ (although that shouldn't really matter since