Questions tagged [trigonometry]
Trigonometry is a branch of mathematics that studies triangles and the relationships between their sides and the angles between sides
3,199
questions
0
votes
1
answer
31
views
Generating a curved path on hexagon grid
I made my account just for this, as I have 0 clue where to start when tackling this problem. I have a grid of hexagons and I want to generate a path from point a to b right now I can generate a ...
0
votes
2
answers
31
views
Calculating Turn Angles given GeoCoordinates
I'm given three GPS points for instance in terms of their geocoordinates (longitude, latitude) that are relatively close to each other:
p1 = (p1_lon, p1_lat)
p2 = (p2_lon, p2_lat)
p3 = (p3_lon, p3_lat)...
1
vote
2
answers
24
views
Using Angle in degrees to draw arrow in the direction in Javascript on Canvas
So I looked at the answer here: Draw arrow head in canvas using Angle
But it didn't seem to do it the way I wanted. I definitely do not want to use rotate, what I would like, is based on an Angle in ...
0
votes
1
answer
43
views
Trigonometric Equation only works with specific input ( 5 ) doesn't work with other inputs
I try to write code for that calculation angles from lengths of triangle. formula is
cos(a)=b^2+c^2-a^2/2bc. (Triangle is here)
angle1 = acosf((powf(length2,2) + powf(length3,2) - powf(length1,2)) / 2 ...
0
votes
2
answers
38
views
SymPy returns no solution for a simple set of trigonometric equations
I'm trying to solve the following equations:
cos(a) - cos(b) - 1 = 0
and
sin(a) - sin(b) = 0
Using SymPy I get no solutions for (a,b).
from sympy import symbols, sin, cos, solve, Eq
a, b = symbols(&...
0
votes
1
answer
20
views
Unreal Engine 5: place cameras on a hemisphere
I have a hemisphere with radius 250. Located on the edge of the hemisphere (15 degrees above the base/horizon), I have 7 equally spaced points (i.e., 1 point every 360/7 degrees).
Using Unreal Engine ...
0
votes
1
answer
29
views
Scipy Curve fit, trigonometry model
I am trying to model a specific trig function given x and y values from the table. The function I am supposed to find parameters to is of the form $A\cdot sin(x\cdot t + ph) +d$. There $A$ is the ...
0
votes
0
answers
14
views
Find amplitude of sine wave by 3 sampling points
I have a project for medical purpose. It is required to find amplitude of a sine save in y=ASin(wt+theta). Now I have at least 2 sampling points and so the equations y1=ASin(wt1+theta) and y2=ASin(wt2+...
1
vote
1
answer
34
views
Curve the vertex of a rotating triangle in SVG
I have a function which generates a SVG "needle", which is part of a gauge (think speedometer).
function calculateNeedlePath(params: {
percentage: number;
needleLength: number;
...
-1
votes
0
answers
28
views
C# WPF Detect in canva if a shape exceeds the size of another one
I have a project to realize.
To make it, need to verify if a rectangle shape with custom size where x, y, z are entered in a textbox,is getting of the borders of another shape that is not a rectangle.
...
0
votes
0
answers
50
views
solving trigonometric nonlinear equations using python
I am trying to solve trigonometric equation but I am getting error could not solve 2490x - 833acos(6889*cos(x)/2401 - 4488/2401) . What am I doing wrong?
from sympy.solvers import solve
from sympy ...
0
votes
0
answers
27
views
In Sql Server create spider grid logic around a coordinate
I have a table of locations with monetary values and lat/lngs in Sql Server. When I add a new location I want to calculate the largest sum product $ of locations values within a 200m radius using sql. ...
0
votes
2
answers
63
views
How to find rotated originX and originY
Problem description with example
Let's say that at the beginning I have a group of 1 rectangle of size 50x50. Top left corner of my group has following coordinates: { x: 0, y: 0 }. Now I apply ...
0
votes
2
answers
34
views
Problem with curve_fit using a trig function of numerical integration, spicy, Python 3
Attempting to fit a model to observational data. The code uses data in the range of 0.5 to 1.0 for the independent variable with scipy curve_fit and numerical integration. The function to be ...
1
vote
1
answer
29
views
Loop over multiple data frames with mathematical function
I have 5 data frames, split from one according to a variable, to which I want to apply the same function based on the same 3 columns from each data frame. Each contains 10,000 rows.
My data:
Dist ...
0
votes
0
answers
32
views
scala: read csv of documents, create cosine similarity
I'm reading in dozens of documents. They seem to be read into both RDD and DFs as a string of columns:
This is the schema:
root
|-- _c0: string (nullable = true)
|-- _c1: string (nullable = true)
|...
0
votes
0
answers
45
views
Shift phase between two sinusoids in Python
How to find Shift phase between two sinusoids in Python.
For example, I created two sinusoid with phase shift 180 radian (Visually). Can we calculate the phase shift in python script if we know only ...
1
vote
1
answer
95
views
Trigonometry calculate tilt angle from accelerometer data
I have the following Figure and the equations:
Three Axis for measuring tilt
Equations for measuring tilt
The body on the Figures is a tri-axial accelerometer sensor, which measures accelaration in ...
0
votes
0
answers
23
views
created algorithm to calculate turning angles; is there a simpler method?
I created an algorithm to calculate turning angles. The algorithm is sensitive to whether the next vector moves left or right of the previous vector. These are the steps my algorithm follows:
...
0
votes
1
answer
37
views
Javascript - Error when calculating sine of complex numbers with a high magnitude
I am making a sine calculator that will be able to evaluate the sine of complex numbers by using polar coordinates and calculating part of the infinite series that defines the sine function. The ...
2
votes
1
answer
91
views
Where is Rust source for sin() cos()?
I looked into the source of Rust compiler, looking for the sin() and cos() functions of the f64 type and I cannot find it. It looks like there is just a reference to an intrinsic function, which does ...
1
vote
1
answer
29
views
Convert screen space X,Y position into perspective projection with a specific z position
I'm using ThreeJS, but this is a general math question.
My end goal is to position an object in my scene using 2D screen space coordinates; however, I want a specific z position in the perspective ...
1
vote
1
answer
55
views
I want to move a square in a circular motion in java processing
This is a school project so i cannot use a lot of functions like translate or rotate. I have to use basic trigonometry to do this. So I have made a square and I need it to move in a circular motion ...
-1
votes
1
answer
41
views
HTML Canvas/THREE.js Apply clip path and opacity on first layer (composed of multiple shapes) depending on the second layer shape
HTML Canvas or Three.js experts,
I have a task this is very similar to and I have big difficulties in finding a solution, most probably because I am a newbie in THREE.js/HTML Canvas, a suggestion on ...
0
votes
0
answers
62
views
Implementing a zoom function but can't get it to work properly
let scale = 1;
let translateX = 0;
let translateY = 0;
let element = document.querySelector('img');
let zoom = ( e ) => {
e.preventDefault();
let formerScale = ...
1
vote
1
answer
36
views
Finding length of arc on unit circle only given x position
Some background:
I've been trying to map a texture onto a "sphere" using a look up table of texture co-ordinate changes. This is for a really slow micro controller to draw on a little LCD ...
1
vote
2
answers
56
views
Draw the Limacon of Pascal with Turtle
I'd like to replicate this picture using Turtle.
I apparently have problems with spatial thinking, so the code just loops, although according to my idea it should scroll.
from turtle import*
from ...
0
votes
3
answers
51
views
Why is my np.arccos not working in my for loop?
I have a for loop with a formula whit gives the following error:
RuntimeWarning: invalid value encountered in arccos
test3[i] = np.arccos(temp.x[i])
If I perform the formula withouth the np.arccos,...
0
votes
0
answers
36
views
Tangent Space View Direction based factor value remap
I'm trying to setup a mask similar to what Fresnel produces. Unfortunately Fresnel gives pretty bad results at grazing angles so I ended up using this :
float mask = abs(-viewDirTangentSpace.x / ...
0
votes
2
answers
59
views
How to go through two colours with sine wave in p5.js
I know how to do it with black and white
let a = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
fill(map(sin(a), -1, 1, 0, 255));
rect(20, 20, 50);
...
0
votes
1
answer
31
views
generate time series for day & year fluctuations using python
I want to generate a time series with temperature as the y axis and hours in a year as the x axis.
I am thinking of two sine waves:
1 - One with the period set to 1 day (to simulate low temp at night ...
0
votes
1
answer
34
views
Trigonometric Functions: Argument reduction
I'm trying to implement trigonometric functions for interval arithmetic, preferably with < ulp error which requires precisely compute trigonometric functions manually. The first step is usually ...
1
vote
1
answer
43
views
How can the arctan2 function be calculated for time?
So, I am trying to calculate the solution of the transcendental equation of the form:
a*cos(t)+b*sin(t)= c*cos(t)+d*sin(t)
for t which can be re-caste as:
tan(t)=(a-b)/(d-c)
Now, one can simply use ...
-1
votes
1
answer
70
views
Why does my cosine of 90 degree shows as -4.371139E-08 in output [duplicate]
This is the code
This is the Output I am getting
Console.Write("Enter angle in degrees: ");
// angle == 90
float angle = float.Parse(Console.ReadLine());
float radian = angle * (MathF.PI / ...
0
votes
2
answers
31
views
Difficulty calculating Law of Sines in Java
In this, I'm trying to follow law of sines in order to find angle A. The correct answer for this is 39.41 but for some reason, I'm not getting the correct inverse sine value. How can I fix this?
...
0
votes
1
answer
33
views
How to back calculate position or arm vector from moment and force vectors?
I have moment vector calculated from Force and arm vectors.
import numpy as np
R = np.array([450]).reshape(1,1) # force magnitude
r = np.array([-0.5, 0.5, 0.7071]).reshape(1,3) # force direction unit ...
0
votes
0
answers
27
views
Perceptron model: Effect of the learning rate when all weights are initialized to zeros
In Python Machine Learning 2rd book, related to the weight initialization step in the Perceptron, the author wrote:
I'm not expert at Trigonometry and Algebra so I don't really understand how the ...
0
votes
0
answers
23
views
Given a point in a square determine what diagonal half it is in?
Given this diagram and assuming the square is normalized to (0,0) to (1,1), if I have any arbitrary point (P) inside the square how would I determine which diagonal half it is in? The algorithm should ...
0
votes
0
answers
46
views
Java Rotate Vector3f by Angle (Like as a transformation matrix, but in java code instead of shader code)
I am writing a physics system for my 3D java lwjgl game, but I have been stuck on one problem for days.
I want to rotate a vector around from it's origin. This will allow me to rotate a mesh by ...
0
votes
1
answer
31
views
Range of trigonometric functions in python
from math import *
def f(a,b,c,d):
alpha = arccos(a/d)
beta = pi - arcsin(a+b/d)
theta= arccos(a/c)
eta= arccos (a+c/b+d)
return (alpha, beta, theta, eta)
I was thinking ...
0
votes
0
answers
34
views
Calculate object rotation based on terrain normal
Hello I'm programming a 3d game in c# monogame and currently I'm working on foliage.
I'm wanting foliage to face upwards as the same direction as the terrain tile its on, I have the normal of the tile ...
5
votes
4
answers
222
views
How to calculate `sin(a^b)` where `a^b` can be a very large double number?
I wonder if there is an algorithm for doing that.
Consider sin(60.9^100) for example,
How to make 60.9^100 - 2pi *N in 2 pi range.
0
votes
0
answers
41
views
Python: Help troubleshooting code for generating a cross section of an object
The aim of my code is to take a 3D object with known internal structure, and generate a 2D cross section based on coordinates in a CSV. It will then draw the cross section with matplotlib. The CSV is ...
0
votes
1
answer
50
views
How do I make circles that touch each other and their centers lies on one circle in tkinter pyton?
I have program where you enter word and it should make as many circles as the word has letters. Circles should also touch each other, not overlap, and thier centers should lie on circle and are ...
0
votes
0
answers
91
views
Periodic function generator, wavelength error after thousand of cycles
I am generating from C++ code various forms of a PCM sound wave using composed harmonics of sine functions, then after importing file in Audacity to see the result, import is done at a maximum sample ...
-2
votes
1
answer
70
views
How to use arccos in Lazarus (pascal)
I have to write a program to find out the angles of a triangle. For some reason I always get the message 'INVALID OPERATION' which results in the program crashing. Can someone help me?
function ...
1
vote
1
answer
38
views
How to find point on the circumference of a circle from an angle
position holds the center of a circle with a diameter variable.
enemy.position is the top left corner of a square which is an enemy, size is the width and height of the enemy.
I am using pVector and ...
0
votes
3
answers
89
views
reposition object in circle
As you can see on the image, I have a p1 and p2 objects with (x,y) coordinates which I know the values, and I know radius of all these circle objects.
However, I want to calculate new position x,y ...
3
votes
2
answers
74
views
Sudden jump in sin function frequency
I'm writing signal source for digital signal processing and found strange behaviour. Here is the code:
float complex *output = malloc(sizeof(float complex) * 48000);
FILE *f = fopen("...
0
votes
0
answers
29
views
Making Multiple Lines Separated By An Angle w/o using DrawPie
Beginner here, I need to separate a wheel by multiple lines without using the DrawPie method. I've been using guess and check but I feel so many lines is inefficient and I wanted to know if there's a ...