我有一个圈子,实际上是一个lat子位置,测量在计量器上。 我还有一条公路A-B,被定义为两个排线阵地。 我如何看待这条公路是否穿过圈子。 如果没有预测的排位进入Xy级,是否可行? 如果有可能,请告诉我如何这样做。 I m实际上试图在导航软件中安装天线至公路功能。 因此,这不是一个家庭工作,而简单易行的程序非常受赞赏,因为数学上我非常坏。
感谢。
我有一个圈子,实际上是一个lat子位置,测量在计量器上。 我还有一条公路A-B,被定义为两个排线阵地。 我如何看待这条公路是否穿过圈子。 如果没有预测的排位进入Xy级,是否可行? 如果有可能,请告诉我如何这样做。 I m实际上试图在导航软件中安装天线至公路功能。 因此,这不是一个家庭工作,而简单易行的程序非常受赞赏,因为数学上我非常坏。
感谢。
I do not know the lat-long representation.
But - in general this question does not require a high math.
First build the equation of the Line between A to B (call the line L1).
Then find the equation of the perpendicular line to L1 that pass through the center of the circle (call it L2).
Then find the intersection of the two equations and check if the intersection point is inside the circle and if it is in [A-B].
解决办法不可取,不需要很多东西。
然而,你可以更大胆地实施:
2. 将你带入一系列要点,然后衡量从每一点到贵国圈子的距离:
将两点变成一系列坐标的方法(我只简要测试了这种方法)
public static Point[] generatePath(int startX, int startY, int endX, int endY) {
_deltaX = Math.Abs(endX - startX);
_deltaY = Math.Abs(endY - startY);
if ( _deltaX >=_deltaY ) {
//x is independent variable
_numpixels = _deltaX + 1;
_d = (2 * _deltaY) - _deltaY;
_dinc1 = _deltaY << 1;
_dinc2 = (_deltaY - _deltaX) << 1;
_xinc1 = 1;
_xinc2 = 1;
_yinc1 = 0;
_yinc2 = 1;
} else {
//y is independent variable
_numpixels = _deltaY + 1;
_d = (2 * _deltaX) - _deltaY;
_dinc1 = _deltaX << 1;
_dinc2 = (_deltaX - _deltaY) << 1;
_xinc1 = 0;
_xinc2 = 1;
_yinc1 = 1;
_yinc2 = 1;
}
// Make sure x and y move in the right directions
if ( startX > endX ) {
_xinc1 = -_xinc1;
_xinc2 = -_xinc2;
}
if ( startY > endY ) {
_yinc1 = -_yinc1;
_yinc2 = -_yinc2;
}
_x = startX;
_y = startY;
Point[] returnPath = new Point[_numpixels];
for ( int i = 0;i < _numpixels;i++ ) {
returnPath[i].X =_x;
returnPath[i].Y =_y;
if ( _d < 0 ) {
_d = _d + _dinc1;
_x = _x + _xinc1;
_y = _y + _yinc1;
} else {
_d = _d + _dinc2;
_x = _x + _xinc2;
_y = _y + _yinc2;
}
}
return returnPath;
}
2. 计算贵圈子距离点至贵线每一点的方法:
public static double GetLenghtBetweenPoints(Point Source, Point Distination) {
return Math.Sqrt((Math.Pow((Source.X-Distination.X), 2) + Math.Pow((Source.Y-Distination.Y), 2)));
}
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...