How to solve my simple geometric task? [closed] - geometry

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
It seems I completely forgot geometry :-( It looks like a simple. I need it for my flash game.
I drawn it in Carmetal program:
I need coordinates of C(x,y). Please help me to find a solution.

You can stick with simple trig...
Here, the blue line length is (By - Ay). So the angle at B is acos((By - Ay) / AB). Subtracting that angle from the angle ABC, you find the angle at B in the larger triangle. Knowing the length BC and that angle, you can calculate the length of the brown line with
l1 = BC/sin(small_angle)
Similarly, the length of the blue and red lines together is
l2 = BC/cos(small_angle)
And C is (Bx + l1, By - l2).

Related

How to check if a point is with in tolerance of another point inside a same circle [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I was trying to build a function that return points that are within in tolerance of other points.
I have a circle and have some points inside a circle. All these points have tolerance circles. I was trying to find if there is any points which is inside tolerance circle of these individual points. For better understanding I am attaching a drawing.
Circle with points
I am trying to find if red point is on or inside tolerance circle of green point.
Thanks
If you have the two points (x1, y1) and (x2,y2), then distance between them is:
dist = square root of (x1-x2)^2+(y1-y2)^2.
If the radius of the tolerance is smaller than this distance, it is inside the tolerance circle.
My idea: Coordinates, each point has (x,y),you need to calculate do distance between two points (there is mathematical formula for it) is greater then sum of their radius (of their tolerance circles).

Geometry module for Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am looking for a geometry module with similar feature as Geogebra for Python.
I would like to, from a set of defined length calculates coordinates of points and some transformations such as rotation of x degrees, symmetrical from a point from some line, compute the intersection between a circle and whatever point, compute the perpendicular line to a segment, middle point etc. Then plot a polygon obtained by joining transformed points using let's say matplotlib.
Does such a module exist ? I could build it from scratch but having those features would save me much time.
Thank you so much.
You can use sympy for some of these, in particular the geometry module.
Shapely is also pretty popular.

What is the formula for calculating these probabilities? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
The probability that you randomly choose a red marble from a bag is is 0.6. A random sample of 6 marbles are drawn from the bag (The sample has an appropriate binomial distribution.)
What is the probability that exactly four of these marbles are red?
What is the probability that two or fewer of these marbles are red?
The probability is according to the binomial distribution:
So to calculate the probability for 4 red marbles outta 6 from scratch using python, it will be:
n = 6
k = 4
p = 0.6
import scipy.special
# the two give the same results
scipy.special.binom(n, k)*(p**k)*((1-p)**(n-k))
0.31104000000000004
We can use the binomial distribution from scipy:
from scipy.stats import binom
binom.pmf(4,6,0.6)
0.31104
For two or fewer of these marbles are red, basically it's the probability of 0,1,2
sum(binom.pmf([0,1,2],6,0.6))
0.17920000000000008
Or you can use the cdf:
binom.cdf(2,6,0.6)

Determining whether one string is a cyclic rotation of another? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to solve the following problem:
Give a linear-time algorithm to determine if a text T is a cyclic rotation of another string T'. For example, arc and car are cyclic rotations of each other.
I have no idea where to start. How can I solve this problem?
As a hint: if x and y have the same length, then x is a cyclic rotation of y iff x is a substring of yy. Try proving this and using this as the basis for your algorithm.
Hope this helps!

Good name for a geometrical function [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
There is a function of a 2D geometrical shape and 1D interval,
f(s, i) = Py (s ⋂ i×(-∞,∞))
It calculates intersection of shape with infinite vertical rectangle (determined by given interval i = [x1, x2)) and then projects it to Y axis.
Is there a good name for this function?
GetIntersection seems like an obvious candidate...
If you don't like Blindy's answer maybe you can call it:
ProjectoToYAfterIntersectingInfiniteRectangle(x1,x2)
But I would go with just GetIntersection as Blindy said +1

Resources