How to find Centroid for a rectangular section inclined at an angle theta? Is there any general formula available?
Centroid of a rectangle is situated at intersection of it's diagonals (or arithmetic mean of all vertices). So it is enough to find vertice coordinates after inclination
Centroid of a rectangle does not changes, after inclination.
Only the co-ordinates of a Rectangle changes with the following equation.
x′=xcosθ − ysinθ
y′=xsinθ + ycosθ
where,
(x,y)-initial co-ordinates of rectangle.
(x',y')-final co-ordinates of rectangle.
θ-angle of inclination.
Refer link for detail.
Related
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.
When I want to draw a pie chart in SVG, all tutorials say that you need to calculate the end point of the arc element. Unless you want an exact 90° angle, that calculated point must unvariably fall beside the circumference line of the underlying circle because of rounding, if you scale up the scalable (!) graphic.
I cannot believe there is no way to draw a circle segment by giving a center, a radius and an angle.
Or is there?
Does anyone know how to draw a circular, minor arc given the centre point and two other points that lie on the circle?
I want to draw the pixels directly to the screen, and preferably, not have to calculate the angles.
I am using SDL and C, but may be OK studying code given that uses a different language.
Thanks.
All points on a circle are equal distance to the centre.
Given you know two points on the circle you can calculate this distance.
Assuming you have cartesian coordinates, for every x or y value between the known points calculate the other value so that the point is equal distance to the centre and plot these points.
I think this is conceptually the easiest way, though not the most efficient.
Given 3 2d points that form a triangle, is there a property of a triangle which does not change after any sort of rotation which would help in giving me the direction vector for that triangle. For eg if a triangle is isosceles i can get the direction vector by joining the midpoint of the base to the opposite vertex and I know which 2 points make the base by looking at the distances. Similar thing can be done for right angle triangles.
Can this be generalized to all triangles?
It seems that only an isosceles (or near-isosceles) triangle can be pointing in a certain direction.
Calculate the 3 angles of the triangle, the side surrounded by the two identical (or perhapse similar) angles is your base. Then go from there.
As an input, I receive some planar, triangulated geometry. Now, I need to compute the four coordinates of the corners of the bounding rectangle. Any Ideas?
I'm going to assume that you mean 2D space in the question title, because everything else refers to 2D.
Go through all the vertices (x,y) in your geometry, and calculate the maximum and minimum of the x's, and the max and min of the y's.
Then the vertices of your bounding rectangle will be (min_x,min_y), (max_x,min_y), (max_x, max_y), and (min_x, max_y).