What is the center of gravity for a quarter parabolic elips? - geometry

I could not find anywhere the center of gravity for half of the parabolic elips area (shown in figure) which formula is x^n+y^n=1, starting from a x,y value. I need parametric answer but if not possible, n might be assumed as 4 and x,y(0.4,0.4) as shown in figure.

Related

What is the endpoint calculation in the Xiaolin Wu algorithm doing?

The Xiaolin Wu algorithm draws an anti-aliased line between two points. The points can be at sub-pixel, i.e. non-integer coordinates. I'll assume the reader is familiar with the algorithm and just recall the important features. We loop across the major (longer) axis of the line, let's say it's the x-axis, basically proceeding column-by-column. In each column we color two pixels. The computation is equivalent to this: place a 1x1 square centered on the line, at the point whose x coordinate is the center of the the given column of pixels. Let's call it S. If we think of each pixel as a 1x1 square in the plane, we now calculate the area of intersection between S and each of the two pixels it straddles, and use those areas as the intensities with which to color each pixel.
That's nice and clear, but what is going on with the calculations for the endpoints? Because the endpoints can be at non-integer positions, they have to be treated as a special case. Here's the pseudocode from the linked Wikipedia article for handling the first endpoint x0, y0:
// handle first endpoint
xend := round(x0)
yend := y0 + gradient * (xend - x0)
xgap := rfpart(x0 + 0.5)
xpxl1 := xend // this will be used in the main loop
ypxl1 := ipart(yend)
plot(ypxl1, xpxl1, rfpart(yend) * xgap)
plot(ypxl1+1, xpxl1, fpart(yend) * xgap)
I edited out the if (steep) condition, so this is the code for the case when the slope of the line is less than 1. rfpart is 1-fpart, and fpart is the fractional part. ipart is the integer part.
I just have no idea what this calculation is supposed to be doing, and I can't find any explanations online. I can see that yend is the y-coordinate of the line above xend, and xend is the x coordinate of the pixel that the starting point (x0, y0) is inside of. Why are we even bothering to calculate yend? It's as if we're extending the line until the nearest integer x-coordinate.
I realize that we're coloring both the pixel that the endpoint is in, and the pixel either immediately above or below it, using certain intensities. I just don't understand the logic behind where those intensities come from.
With the Xiaolin Wu algorithm (and sub-pixel rendering techniques in general) we imagine that the screen is a continuous geometric plane, and each pixel is a 1x1 square region of that plane. We identify the centers of the pixels as being the points with integer coordinates.
First, we find the so-called "major axis" of the line, the axis along which the line is longest. Let's say that it's the x axis. We now loop across each one-pixel-wide column that the line passes through. For each column, we find the point on the line which is at the center of that column, i.e. such that the x-axis is an integer. We imagine there's a 1x1 square centered at that point. That square will completely fill the width of that column and will overlap two different pixels. We color each of those pixels according to the area of the overlap between the square and the pixel.
For the endpoints, we do things slightly differently: we still draw a square centered at the place where the line crosses the centerline of the column, but we cut that square off in the horizontal direction at the endpoint of the line. This is illustrated below.
This is a zoomed-in view of four pixels. The black crosses represent the centers of those pixels, and the red line is the line we want to draw. The red circle (x0, y0) is the starting point for the line, the line should extend from that point off to the right.
You can see the grey squares centered on the red crosses. Each pixel is going to be colored according to the area of overlap with those squares. However, in the left-hand column, we cut-off the square at x-coordinate x0. In light grey you can see the entire square, but only the part in dark grey is used for the area calculation. There are probably other ways we could have handled the endpoints, for instance we could have shifted the dark grey region up a bit so it's vertically centered at the y-coordinate y0. Presumably it doesn't make much visible difference, and this is computationally efficient.
I've annotated the drawing using the names of variables from the pseudocode on Wikipedia.
The algorithm is approximate at endpoints. This is justified because exact computation would be fairly complex (and depend on the type of endpoint), for a result barely perceivable. What matters is aliasing along the segment.

Simple circle packing problem with circles of different size

Is there an analytical solution to find the intersection point between the placed grain and grain 1 if the placed grain is lowered [in the reference frame of the image] along the dotted line? We know the radius of both circles. We have graphical figured out the intersection point and labelled it for reference in the image.
Assuming
a right angle between the dotted line and the line through the center of g1 and g2
the dotted line is a tangent of g1
you can use the following:
Consider the situation when g1 and gp touch. In that case, the length of the line segment between center g1 and gp is equal to radius(g1) + radius(gp). Which is also the hypotenuse of a right-angled triangle for which radius(g1) is a cathetus. arccos(radius(g1)/(radius(g1) + radius(gp))) gives you then the angle between the hypotenuse and cathetus around the center of g1.
This angle and the length radius(g1) are polar coordinates of the intersection point relative to the center of g1.

Shading Area Between Two Line Charts and Axes

I am on day #2 of searching the web and, while I have found plenty of hits that seem like they should work, none of them seem to apply to my particular situation.
I have an Excel chart with two series displayed. One is a sort of exponential decay curve, and one is a constant that intersects with the exponential curve, but does not continue past it (the final x-value of the orange line is estimated to make it look like it intersects the blue curve):
The raw data for the blue curve is as follows (leaving off data labels for confidentiality reasons, but x-values are on the left and y-values are on the right):
The orange line is simply set at 24 all the way across until it intersects with the blue curve.
So here's the problem I need to solve: I need to fill in all of the area below the blue curve with one color, and I need to fill in the area below the orange line with another color. Everything above the blue curve needs to be blank (transparent). Here's an illustration of what I want:
I know in order to get the coloring/shading I need to use an area chart. However, when I try to change the chart type to Area the scales of the axes change for each series and they no longer match up, and I am unable to edit the axes (can't set min, max, etc) to make them match up again. Additionally, only the area directly beneath the constant line fills in (as expected), but I am looking for a way to fill in the area between the orange line, the blue curve, and the axes:
How might one go about doing what I need to do?
If there's any other information I could provide that would be of help, please let me know and I'll be sure to add it in.
EDIT:
I can extend the orange line to follow the blue line off to the right, which may help fill in the lower area. However, when I switch to an area chart I still get the issue with mismatched axes with scale I can't edit:
Notice how the "567" point (the x-value where the orange line should intersect the blue curve) is spaced evenly between "500" and "600", rather than scaling slightly to the right of center as I would have expected.
How do I keep the spacing of one tick every 100 units on the x-axis but keep the datapoint for 567?
You could find the intersection point's coordinates (graphically or analitically), then split your data in two separate series within the same graph as follows :
Edit post comment section :
For some reason x-values are considered by default as text.
Righ click the x-axis > format > Select date on the axis
Then play with the principal and base in days/months to have the intervals you want.
Good parameters for this data :
main : 100 in days
base : in days
I would just have two identical charts : one does the blue and the other the orange then lay the orange chart on top of the blue and make it transparent ... worked a treat in the past...

Gaps Between Rectangles Connected at the Center

I'm experimenting with a vector based graphics style with objects represented as series of line segments with a given width(it would probably be easier to think of these as rectangles). The problem is that these segments are connected at the center and leave a gap (shown below). I've determined that the most efficient way to cover this gap is simply to cover it with a triangle, and since I'm working in OpenGL, all I need are the points of the two points that don't overlap with the other rectangle, the third point being the center point where the two line segments(rectangles) are connected. How can I determine which points I need to use for the triangle, given that I have all of the points from both rectangles?
EDIT: I will also accept alternative solutions, as long as they cover up that gap.
EDIT 2: Nevermind, I solved it. I'll post code once I have better Internet connection.
Maybe I'm misunderstanding the question... but if you zoom in on the top corner of your red pentagon, you get something like this, am I right?
where A and B are nodes on the rectangle for edge1 and C and D are nodes on the rectangle for edge2. You say you already know these coordinates. And from what you say, the edges meet at the centre, which is halfway between A and B, and also halfway between C and D. So call this point X, and you can calculate its coordinates easily I guess.
So all you need to do is draw the missing triangle AXC, right? So one way would be to determine that A and C are on the "outside" of the polygon (and therefore need filling) and B and D are on the "inside" and therefore don't. But it's probably easier to just draw both, as it doesn't hurt. So if you fill AXC and BXD, you'd get this:
The solution I found assumes that there are 3 basic cases:
First, the three unique center points for the two rectangle proceed upward (positive y direction) so the gap is either on the left or right of the connection. In my code, I had the corner points of the rectangle organized by their orientation to the left or right of the center point, so if the bottom rectangle's left point is below the top rectangle's left point, then the gap is between the left points of the two rectangles, otherwise the gap is between the right points.
Second, the three unique center points have a maximum at the center most of the center points, so the gap is on the top. The gap is then between the two points with the maximum y values.
Third, the three unique center points have a minimum at the center most of the center points, so the gap is on the bottom. The gap is then between the two points with the minimum y values.
[I'll post pictures of the example cases if it is requested]

Rotate X,Y Coordinates from Bottom Right to Top left

I'm using NodeXL to plot a lot of points which are actual coordinates for cities.
The thing is that the way it's plotted now is that North America is on the Bottom Right but it should be on the top left like on a normal map.
It's like this for all of the points so pretty much I need to rotate the whole graph so that what's on the bottom right will be top left after transformation, and what's on the top right will be on the bottom left.
I have two columns with X and Y points as follows (for example):
X Y
6,238.2 9,896.0
6,141.9 9,896.0
I'm not sure the formula or Math behind this kind of rotation.
The graph is only positive so from (0,0) upward and outward to the right, there are no negative values on the x or y axis.
Could anyone help me out?
For the sake of an answer:
To quote #Tim Williams: Instead of plotting x and y plot (width-x) and (height-y)
Example:

Resources