Points on Cycle

There is a cycle with its center on the origin. 
Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other
you may assume that the radius of the cycle will not exceed 1000.
 
Input

There are T test cases, in each case there are 2 decimal number representing the coordinate of the given point.
 
Output

For each testcase you are supposed to output the coordinates of both of the unknow points by 3 decimal places of precision 
Alway output the lower one first(with a smaller Y-coordinate value), if they have the same Y value output the one with a smaller X. 

NOTE
when output, if the absolute difference between the coordinate values X1 and X2 is smaller than 0.0005, we assume they are equal.
 
Sample Input

 2
1.500 2.000
563.585 1.251 
 
Sample Output

 0.982 -2.299 -2.482 0.299
-280.709 -488.704 -282.876 487.453 

给出一个以原点为圆心的圆上的一点,问其内接等边三形另外两个点的坐标
刚开始想直接利用三角函数角度的偏移来计算,但是在c中通过反三角函数求出来的角度只能是在-90到90度之间,并不是0到360度,所以无法准确定位角在哪一个向限。所以只能通过向量a向量b,a*b=1/2*|a||b|;a*a+b*b=r*r  x^2+y^2=r^2,这三个公式进行计算


#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
 
int main()
{
    int t;
    scanf("%d",&t);
    while(t--){
        double x1,y1,r;
        scanf("%lf%lf",&x1,&y1);
        r = x1*x1+y1*y1;
        double a = 1;
        double b = y1;
        double c = r/4-x1*x1;
        double delta = b*b-4*a*c;
        double ansy1 = (-b-sqrt(delta))/2/a;
        double ansy2 = (-b+sqrt(delta))/2/a;
        double ansx1,ansx2;
        if(fabs(x1)<=1e-7){
            ansx1 = -sqrt(r-ansy1*ansy1);
            ansx2 =  sqrt(r-ansy2*ansy2);
        }
        else{
            ansx1 = (-r/2-y1*ansy1)/x1;
            ansx2 = (-r/2-y1*ansy2)/x1;
        }
        printf("%.3lf %.3lf %.3lf %.3lf\n",ansx1,ansy1,ansx2,ansy2);
    }
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
3.4 Pair Interaction Feature The interaction pattern between two individuals is encoded by a spatial descriptor with view invariant relative pose encoding. Given the 3D locations of two individual detec- tions zi,zj and two pose features pi,pj, we represent the pairwise relationship using view normalization, pose co-occurrence encoding, semantic compression and a spatial histogram (see Fig. 5 for illustration). The view normalization is performed by rotating the two people in 3D space by θ with respect to their midpoint, making their connecting line perpendicular to the cam- era view point. In this step, the pose features are also shifted accordingly (e.g. if θ = 45‘, shift 1 dimension with a cycle). Then, the co-occurrence feature is obtained by building a 2-dimensional matrix in which each element (r, c) corresponds to min(pi(r), pj (c)). Although the feature is view invariant, there are still elements in the matrix that deliver the same semantic concepts (e.g. left-left and right-right). To reduce such unnecessary variance and obtain a compact representation, we perform another transformation by multiplying a semantic compression matrix Sc to the vector form of the co-occurrence feature. The matrix Sc is learned offline by enumerating all possible configurations of view points and grouping the pairs that are equivalent when rotated by 180 degrees. Finally, we obtain the pair interaction descriptor by building a spatial histogram based on the 3D distance between the two (bin centers at 0.2, 0.6, 2.0 and 6.5 m). Here, we use linear interpolation similarly to contextual feature in Sec. 3.3. Given the interac- tion descriptor for each pair, we represent the interaction feature φxx(xi,xj) using the confidence value from an SVM classifier trained on a dictionary of interaction labels Y.什么意思
最新发布
07-17

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值