1.实际遇到的笔试题:已知A点坐标,P点坐标,圆的半径r,求圆上点D的坐标
比较简单,但也确确实实遇到了。
//实现逻辑
//坐标P-坐标A=向量PA
//所求D点坐标=坐标A+向量PA的单位向量*半径r
//
//这里假设A点的坐标为(3,4),P点为(10,10),半径R=2
Vector2 pointA =new Vector2(3,4);
Vector2 pointP=new Vector2(10,10);
float radius=2;
private Vector2 GetPoint()
{
Vector2 PA = pointP - pointA;
Vector2 pointD= pointA + (PA.normalized * radius);
Debug.Log(pointD);
return pointD;
}
2.判断点P是否在三角形内部
晚点上传实际解题步骤
既然要写出详细步骤,那就给A B C P附上几个已知点
已知A 点坐标(5,8)B点坐标(2,1)C点坐标(8,1) P点坐标(4,6)
这个解题步骤也很简单,首先把所有点都看成三维的点
即A(5,8,0),B(2,1,0),C(8,1,0) ,P(4,6,0)
分别做AP向量,BP向量,C