本文整理汇总了C#中System.Point.getX方法的典型用法代码示例。如果您正苦于以下问题:C# Point.getX方法的具体用法?C# Point.getX怎么用?C# Point.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Point
的用法示例。
在下文中一共展示了Point.getX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WritePoint
private void WritePoint(Point point, WKBByteOrder byteOrder, bool writeHeader)
{
if (writeHeader)
{
// Write byte order
_writer.Write((byte)byteOrder);
// Write type
this.WriteType(point, byteOrder);
}
// Write the x coordinate.
this.Write(point.getX(), byteOrder);
// Write the y coordinate.
this.Write(point.getY(), byteOrder);
}
示例2: Line
private void Line(Point point1, Point point2)
{
int x1 = point1.getX();
int y1 = point1.getY();
int x2 = point2.getX();
int y2 = point2.getY();
double m = (y1 - (double)y2) / (x1 - x2);
double c = y1 - (x1 * m);
double yIntersect = c;
double xIntersect = c / -m;
bool validYIntersect = false;
bool validXIntersect = false;
if (y1 < y2) {
if (y1 <= yIntersect && yIntersect <= y2) {
validYIntersect = true;
}
} else {
if (y2 <= yIntersect && yIntersect <= y1) {
validYIntersect = true;
}
}
if (x1 < x2) {
if (x1 <= xIntersect && xIntersect <= x2) {
validXIntersect = true;
}
} else {
if (x2 <= xIntersect && xIntersect <= x1) {
validXIntersect = true;
}
}
if(validYIntersect) {
if (yIntersect < 0) {
yLessZero++;
} else if (0 < yIntersect) {
yGreaterZero++;
}
}
if (validXIntersect) {
if (xIntersect < 0) {
xLessZero++;
} else if (0 < xIntersect) {
xGreaterZero++;
}
}
}