How do you find the width of a circle from any given y position? [closed] - html

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I was wondering if anybody knew how to find the width of a circle in any given y position. For example, lets say you have a unit circle, the radius is 100 units tall. Now three fourths the way up the circle, 25 units above the center of the circle, there is a line parallel to the x axis that extends from one edge of the circle to the other. it looks a bit like this.
How big is that line, and what algorithm did you use to solve this?

First, label what you know:
Looks like a triangle to me.
Now, solve for X and double it:
x^2 + 25^2 = 100^2 (Pythagorean theorem)
x^2 = 9375 (Simplify)
x = 96.8 (Square root both sides, now we know x)
Length of chord: 193.6 (Length of chord is 2 times x)
Here is a site that can help you: http://www.mathopenref.com/chord.html
Since you tagged your question with Scratch, here is a function to help you:

Related

Changing the column labels color based on width of chart [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have created a bar chart that has the values of each of the columns at the end of each bar. The color of the bars is the same as the text of the values. The problem is that based on the width of the container/browser by default the values move inside the bar. But then you can't read the text as the bar and text are the same. I would prefer to have the values outside the bar but when they have to move inside the bar due to space is there a way to change the font color to white so that it is readable? Here is an example of the chart.
https://playground.anychart.com/DAlu15WO/2
Unfortunately, there's no possibility to detect if the label was moved inside the bar or not. But you can enable label background to increase its readability like in the sample.
Pay attention to lines 96-97.
All available background settings you can find in the list.

Hot to center those 3 divs into the body [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Im wondering how to center those 3 divs into he body, i created 2 versions of the row, one with an extra outer wrap around the column and one without, Unfortuinatly since this html created with a page builder (WP visual composer) so i dont have 100% freedom to control the html structure. I tried margin: auto but couldn't make it to work.
You can find the divs im talking about on this page.
https://bonmedico.de/test/
Thanks
This question will be closed very soon because it's not according to SO rules. ( Read comments to your question to find about that ). You really should put more effort when writing questions.
But i took a look at your website. You can solve your problem in 2 ( maybe more ) ways.
add justify-content:center to the parent row of those 3 columns. Being a display: flex element it will center them horizontally.
using visual composer is easy. Just add 2 small columns ( empty ) left and right and a larger column in the middle. Something like 1/4 1/2 1/4. And in that ' bigger ' column you can add a new row continaing 3 columns ( like you have now ). Or there are more possibilities to do this. Just ' play ' around with visual composer

Remove padding from text input [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Is it possible to change the inner padding of text field? Currently when you take a normal text field in html and write something in there it'll have padding in the beginning and in the end of it. The numbers written in my text field have at most 3 digits and currently the padding pretty much covers the width of 1.5 to 2 digits and already with 2 digits (see number 10 on image) it'll get a bit dragged out.
Added image of it as well, in the first field the padded area is marked with red line.
I dont have code but
.my_input_class{
padding:0;
}
Or, really, the size of the text box needs to be a bit larger, or you put a character limit on it

Using 2 color functions in a mathematica matrix plot [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 9 years ago.
Improve this question
I'm trying to use 2 color functions within one matrix plot in mathematica. Is this possible to do?
For example, using a very simple matrix:
test = Partition[Table[i, {i, 1, 9}], 3]
I would like to make the even numbers vary in color increasing from white to red; and the odd numbers vary in color from grey to black.
How could I do this? I know how to get the whole matrix to vary in color, but no more than this.
You could try defining a ColorFunction as below.
CheckerPlot[array_?MatrixQ] :=
With[{len = Length[Flatten[array]]},
ArrayPlot[array,
ColorFunction->(If[EvenQ[#], Blend[{White, Red}, #/len],
Blend[{Gray,Black}, #/len]] &),
ColorFunctionScaling -> False]
]
Execute by using, for example,
CheckerPlot[Partition[Table[i, {i,1,36}], 5]]

Trigonometry - Calculate an angle based on a fixed central point [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a 1000x1000 grid with a fixed point (p1) in the centre and a variable point (p2). How can I calculate, in degrees, the angle indicated in red? The vertical blue line will always be fixed as 0 degrees.
Many thanks in advance.
A few hints to guide you in understanding why the solutions you've seen/will see work...
Let p2 be sitting in the position (x,y) on your grid; What is the projection of p2 onto the x axis, or p2 onto the y axis?
Where is p1 located?
How do you determine the distance between two points on a coordinate axis?
What would pythagoras say the length of the line connecting p1 and p2 is?
What trigonometric facts do you know of that relate the sides of a triangle to an angle?
If we know cos(x) = a, then x = ...?
You can calculate the angle with the following formula:
if(x>0)
angle = cos^-1(y/(sqrt(x^2+y^2))
else
angle = 180 + cos^-1(y/(sqrt(x^2+y^2))
where x is the horizontal distance between p1 and p2 and y is the vertical.
arctan(p2.y/p2.x) + 90 works for the upper-left quadrant. Depending on how you want to calculate the other quadrants you can either use the same formula or use the inverse as abs(result - 180)