trigonometry

iPhone iOS is it possible to create a rangefinder with 2 laser pointers and an iPhone?

梦想与她 提交于 2019-12-11 10:27:14
问题 I'm working on an IPhone robot that would be moving around. One of the challenges is estimating distance to objects- I don't want the robot to run into things. I saw some very expensive (~1000$) laser rangefinders, and would like to emulate one using iPhone. I got one or two camera feeds and two laser pointers. The laser pointers are mounted about 6 inches apart, at an angle The angle of lasers in relation to the cameras is known. The Angle of cameras to each other is known. The lasers are

Why can't I use _mm_sin_pd? [duplicate]

可紊 提交于 2019-12-11 09:33:08
问题 This question already has answers here : C++ error: ‘_mm_sin_ps’ was not declared in this scope (3 answers) how can I use SVML instructions [duplicate] (1 answer) Where is Clang's '_mm256_pow_ps' intrinsic? (1 answer) Closed 11 months ago . Specifics says: __m128d _mm_sin_pd (__m128d a) #include <immintrin.h> CPUID Flags: SSE Description Compute the sine of packed double-precision (64-bit) floating-point elements in a expressed in radians, and store the results in dst. But it seems it is not

Precision discrepancy between Fortran and Python (sin function)

旧巷老猫 提交于 2019-12-11 06:15:15
问题 I see a discrepancy between python and Fortran when using the sinus function. Could anyone shed light on this, please? in python: import math print(math.sin(6.28318530717959)) >> 3.3077843189710302e-15 in fortran90: print*, sin(6.28318530717959d0) >> 3.3077720792452914E-15 EDIT: As it seems to be a Fortran compiler issue, I used g95 with g95 -O3 test.f90 -o test.exe 回答1: According to IEEE 754 for float representation: In [7]: bin(3.3077720792452914e-15.view(np.uint64)) Out[7]:

How do I prove code with a real axiomatic in Frama-C

血红的双手。 提交于 2019-12-11 06:10:58
问题 I have changed the int type to float in the "Inner Product" code from the ACSL-by-Example book (the code with int type worked for me) and now I am not able to prove the loop invariant inner . I have added some checks for inf and NaN without any success. #include "limits.h" /*@ predicate Unchanged{K,L}(float* a, integer first, integer last) = \forall integer i; first <= i < last ==> \at(a[i],K) == \at(a[i],L); predicate Unchanged{K,L}(float* a, integer n) = Unchanged{K,L}(a, 0, n); lemma

Given bounding rectangle, starting angle, and sweep angle, how to determine points of the arc endpoints

本小妞迷上赌 提交于 2019-12-11 05:09:19
问题 Given a bounding rectangle, starting angle and the sweep angle, how do I determine the points of each end of the arc? private void myPaint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rc = new Rectangle(242, 299, 200, 300); Pen penRed = new Pen(Color.Red, 1); g.DrawArc(penRed, rc, 18, -108); // TODO - Determine Point of each end of arc // Point pt1 = ??? // Point pt2 = ??? } 回答1: Using the equation of an ellipse from this excellent Mathematics answer We can calculate

How to make a wave pattern circularly around a cylinder?

回眸只為那壹抹淺笑 提交于 2019-12-11 04:12:35
问题 Hello i'm trying to make a wave pattern on the surface of a cylinder. The waves should rotate with the rotation of the surface. and in a way the sine period is moving in circles, and the amplitudes are long mounds on the surface. Here's some pictures to better explain what i mean. This is what i'm trying to get the top down view of the cylinder to look similar to: this is the top view of my cylinder. I'd like the wave to change direction with the rotation of the circle, so it looks the same

find the angle of point related to pivot

对着背影说爱祢 提交于 2019-12-11 03:54:24
问题 It’s been days that I’m working on a project which I have to use convex hull in it, and specific method of graham scan. The problem has been solved till the place I want to sort the points. So the story is that I have collected bunch of points which they are from the type Point and their coordinates are relatives. Mean they come from the mouse event x and y. So I have collected the mouse positions as x and y of the points. And I want to find the angle related to the pivot point. Does anyone

How to find third coordinate of triangle when two coordinates and their corresponding angles are given

人盡茶涼 提交于 2019-12-11 02:55:26
问题 i am trying to calculate third coordinate of triangle ABC, where A(x1,y1) B(x2,y2) angle CAB=a1 and angle CBA=a2. i need to find third coordinate C(x3,y3) i had thought of using law of cosines, but they may result some complex equations to solve. i need some simple technique to solve them, or using some direct formulas or any other method that can be implemented in computer program. can anyone help me in this problem? 回答1: At least two ways are possible: Through lines Build a line equation

calculate the angle between a line and x-axis

女生的网名这么多〃 提交于 2019-12-11 00:57:33
问题 I have two points in my coordinate system (x,y) that I want to know the angle of their line and x-axis. I use swift for solving this but I can't get the angle. I need this angle in radians to use it in the following equation: (x0 + r cos theta, y0 + r sin theta) r : radius of circle 回答1: If you have two points, (x0, y0) and (x1, y1) , then the angle of the line joining them (relative to the X axis) is given by: theta = atan2((y1 - y0), (x1 - x0)) 回答2: The angle between a line, for reference,

How to “round” a 2D Vector to nearest 15 degrees

六眼飞鱼酱① 提交于 2019-12-11 00:08:30
问题 I'm working on a simple game and I'm trying to simplify part of the 2D collision reaction in the game. When certain objects hit walls, I'm calculating a collision normal ( collisionPoint - objectCenter ) and reflecting based on that normal. I'm interested in rounding that normal vector to its nearest 15° but I'm not sure of a good way to go about that. My current thought is doing something like this float angle = atan2(normal.Y, normal.X) * Rad2Deg; float newAngle = ((int)(angle + 7.5f) / 15)