本文整理汇总了C#中Point.GetX方法的典型用法代码示例。如果您正苦于以下问题:C# Point.GetX方法的具体用法?C# Point.GetX怎么用?C# Point.GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.GetX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsidePolygon
/**
* InsidePolygon
*
* @param verts
* @param num
* @param pt
* @param ray
* @return boolean
*/
private bool InsidePolygon(Point[] verts, int num, Point pt, Ray ray)
{
int cross = 0;
int xindex, yindex, index = 0;
double xtest, ytest, x0, y0, x1, y1;
if(MaxComp == 0)
{
xindex = 1;
yindex = 2;
xtest = pt.GetY();
ytest = pt.GetZ();
}
else if(MaxComp == 1)
{
xindex = 0;
yindex = 2;
xtest = pt.GetX();
ytest = pt.GetZ();
}
else
{
xindex = 0;
yindex = 1;
xtest = pt.GetX();
ytest = pt.GetY();
}
x0 = GetCoord(verts[num - 1], xindex) - xtest;
y0 = GetCoord(verts[num - 1], yindex) - ytest;
while(num-- != 0)
{
x1 = GetCoord(verts[index], xindex) - xtest;
y1 = GetCoord(verts[index], yindex) - ytest;
if(y0 > 0.0f)
{
if(y1 <= 0.0f)
{
if(x1 * y0 > y1 * x0)
{
cross++;
}
}
}
else
{
if(y1 > 0.0f)
{
if(x0 * y1 > y0 * x1)
{
cross++;
}
}
}
x0 = x1;
y0 = y1;
index++;
}
return ((cross & 1) == 1);
}
示例2: IsEqual
public bool IsEqual(Point rhs)
{
if (rhs.GetX() == this.x && rhs.GetY() == this.y && rhs.GetRotation() == this.rotation) {
return true;
}
return false;
}
示例3: SphereObj
/**
* SphereObj
*
* @param objmaterial
* @param newobjID
* @param neworigin
* @param newradius
* @param MaxX
* @param MinX
* @param MaxY
* @param MinY
* @param MaxZ
* @param MinZ
*/
public SphereObj(Material objmaterial, int newobjID, Point neworigin, double newradius, Point max, Point min)
: base(objmaterial, newobjID)
{
Origin = neworigin;
Radius = newradius;
RadiusSquare = Radius * Radius;
GetMax().SetX(Origin.GetX() + Radius);
GetMax().SetY(Origin.GetY() + Radius);
GetMax().SetZ(Origin.GetZ() + Radius);
GetMin().SetX(Origin.GetX() - Radius);
GetMin().SetY(Origin.GetY() - Radius);
GetMin().SetZ(Origin.GetZ() - Radius);
if(GetMax().GetX() > max.GetX())
{
max.SetX(GetMax().GetX());
}
if(GetMax().GetY() > max.GetY())
{
max.SetY(GetMax().GetY());
}
if(GetMax().GetZ() > max.GetZ())
{
max.SetZ(GetMax().GetZ());
}
if(GetMin().GetX() < min.GetX())
{
min.SetX(GetMin().GetX());
}
if(GetMin().GetY() < min.GetY())
{
min.SetY(GetMin().GetY());
}
if(GetMin().GetZ() < min.GetZ())
{
min.SetZ(GetMin().GetZ());
}
}
示例4: GetCoord
/**
* GetCoord
*
* @param pt
* @param index
* @return double
*/
private double GetCoord(Point pt, int index)
{
if(index == 0)
return (pt.GetX());
else if(index == 1)
return (pt.GetY());
else
return (pt.GetZ());
}
示例5: Point
/**
* Point
*
* @param newpoint
*/
public Point (Point newpoint)
{
Set (newpoint.GetX (), newpoint.GetY (), newpoint.GetZ ());
}
示例6: Link
public void Link(GameObject crystal)
{
if (crystal != null)//水晶连线 && linkStop == false
{
if (!draw)//如果还没开始画线
{
//if (EnergyManager.Instance.accessibleEnergy > 0)
{
#region
float x = 0, z = 0; int kx = -1, ky = -1;
linePoints = new Vector3[2];
linePoints[0] = crystal.transform.position;
z = EnergyManager.Instance.HeroMagicCircle.getz(linePoints[0].z);
if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[2])
x = EnergyManager.Instance.HeroMagicCircle.getx1(linePoints[0].x);
else if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[0] || z == EnergyManager.Instance.HeroMagicCircle.rowKey[4])
x = EnergyManager.Instance.HeroMagicCircle.getx2(linePoints[0].x);
else
x = EnergyManager.Instance.HeroMagicCircle.getx3(linePoints[0].x);
kx = EnergyManager.Instance.HeroMagicCircle.getKx(x);
ky = EnergyManager.Instance.HeroMagicCircle.getKy(z);
if (kx != -1)
{
l1 = new Point( kx , ky);
draw = true;
//EnergyManager.Instance.MinusEnergy(1);
}
screenSpace = Camera.main.WorldToScreenPoint(crystal.transform.position);
linePoints[1] = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));
temp1 = new VectorLine("3DLine", linePoints, Color.green, lineMaterial, 8.0f);
temp2 = new VectorLine("3DLine", linePoints, Color.green, lineMaterial2, 15.0f);
temp1.Draw3DAuto();
temp2.Draw3DAuto();
#endregion
}
//else
//{
// //linkStop = true;
//}
}
else
{
#region
float x = 0, z = 0; int kx = -1, ky = -1;
linePoints[1] = crystal.transform.position;
z = EnergyManager.Instance.HeroMagicCircle.getz(linePoints[1].z);
if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[2])
x = EnergyManager.Instance.HeroMagicCircle.getx1(linePoints[1].x);
else if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[0] || z == EnergyManager.Instance.HeroMagicCircle.rowKey[4])
x = EnergyManager.Instance.HeroMagicCircle.getx2(linePoints[1].x);
else
x = EnergyManager.Instance.HeroMagicCircle.getx3(linePoints[1].x);
kx = EnergyManager.Instance.HeroMagicCircle.getKx(x);
ky = EnergyManager.Instance.HeroMagicCircle.getKy(z);
l2 = new Point(kx , ky);
if (l2 == l1)//连自己=>取消连线
{
VectorLine.Destroy(ref temp1);
VectorLine.Destroy(ref temp2);
//EnergyManager.Instance.MinusEnergy(-1);
}
else if (EnergyManager.Instance.HeroMagicCircle.IsOperable(new Line(l1,l2)))
{
if (kx != -1 && !EnergyManager.Instance.HeroMagicCircle.GetLine(l1, l2) && EnergyManager.Instance.HeroMagicCircle.GetLineSwitch(l1.GetX(), l1.GetY(), l2.GetX(), l2.GetY()))//画线
{
//AddLine(l1, l2);
if (EnergyManager.Instance.accessibleEnergy>0)
{
temp1.Draw3D();
temp2.Draw3D();
line[l1.GetUni(), l2.GetUni()] = temp1; line2[l1.GetUni(), l2.GetUni()] = temp2;
EnergyManager.Instance.HeroMagicCircle.LineTrue(l1.GetUni(), l2.GetUni());
EnergyManager.Instance.MinusEnergy(1);
}
else
{
VectorLine.Destroy(ref temp1);
VectorLine.Destroy(ref temp2);
GuideText.Instance.ReturnText("LinkNeedEnergy");
}
}
else if (EnergyManager.Instance.HeroMagicCircle.GetLine(l1, l2))//删线
{
// Debug.Log("delete");
DeleteLine(l1, l2);
VectorLine.Destroy(ref temp1);
VectorLine.Destroy(ref temp2);
GuideText.Instance.GuideLevel(2, 33, "RedundentLink");
GuideText.Instance.GuideLevel(3, 33, "RedundentLink");
//EnergyManager.Instance.MinusEnergy(-1);
//linkStop = true;
}
}
else
{
GuideText.Instance.ReturnText("NoJumpLink");
return;
}
draw = false;
//.........这里部分代码省略.........
示例7: ReadPoly
/**
* ReadPoly
*
* @param infile
* @param ObjID
* @return int
*/
private int ReadPoly(int ObjID)
{
String temp;
double[] input = new double[3];
int i, j, k;
int numpolys = 0;
int numverts;
bool trimesh, vertnormal;
Point max = new Point(MaxX, MaxY, MaxZ);
Point min = new Point(MinX, MinY, MinZ);
temp = readString();
temp = readString();
Material theMaterial = ReadMaterial();
temp = readString();
if(temp.Substring(7).Equals("POLYSET_TRI_MESH"))
{
trimesh = true;
}
else
{
trimesh = false;
}
temp = readString();
if(temp.Substring(11).Equals("PER_VERTEX_NORMAL"))
{
vertnormal = true;
}
else
{
vertnormal = false;
}
for(i = 0; i < 4; i++)
{
temp = readString();
}
temp = temp.Substring(11);
numpolys = Int32.Parse(temp);
ObjID++;
for(i = 0; i < numpolys; i++)
{
temp = readString();
temp = readString();
temp = temp.Substring(16);
numverts = Int32.Parse(temp);
Point[] vertices = new Point[numverts];
for(j = 0; j < numverts; j++)
{
temp = readString();
temp = temp.Substring(8);
for(k = 0; k < 2; k++)
{
input[k] = (double)Double.Parse(temp.Substring(0, temp.IndexOf(' ')));
temp = temp.Substring(temp.IndexOf(' ') + 1);
}
input[2] = (double)Double.Parse(temp);
vertices[j] = new Point(input[0], input[1], input[2]);
if(vertnormal)
{
temp = readString();
}
}
temp = readString();
TriangleObj newtriangle;
PolygonObj newpoly;
ObjNode newnode;
if(trimesh)
{
newtriangle = new TriangleObj(theMaterial, ObjID, numverts, vertices, max, min);
newnode = new ObjNode(newtriangle, objects);
}
else
{
newpoly = new PolygonObj(theMaterial, ObjID, numverts, vertices, max, min);
newnode = new ObjNode(newpoly, objects);
}
objects = newnode;
}
temp = readString();
MaxX = max.GetX();
MaxY = max.GetY();
MaxZ = max.GetZ();
MinX = min.GetX();
MinY = min.GetY();
MinZ = min.GetZ();
return (numpolys);
}
示例8: Combine
/**
* Combine
*
* @param pt
* @param vector
* @param ptscale
* @param vecscale
* @return Point
*/
public Point Combine (Point pt, Vector vector, double ptscale, double vecscale)
{
x = ptscale * pt.GetX () + vecscale * vector.GetX ();
y = ptscale * pt.GetY () + vecscale * vector.GetY ();
z = ptscale * pt.GetZ () + vecscale * vector.GetZ ();
return (this);
}
示例9: PolyTypeObj
/**
* PolyTypeObj
*
* @param objmaterial
* @param newobjID
* @param numverts
* @param vertices
* @param MaxX
* @param MinX
* @param MaxY
* @param MinY
* @param MaxZ
* @param MinZ
*/
protected PolyTypeObj(Material objmaterial, int newobjID, int numverts, Point[] vertices,
Point max, Point min)
: base(objmaterial, newobjID)
{
numVertices = numverts;
Vertices = vertices;
CalculateNormal();
Vector temp = new Vector(Vertices[0].GetX(), Vertices[0].GetY(), Vertices[0].GetZ());
D = -Normal.Dot(temp);
GetMax().Set(Vertices[0].GetX(), Vertices[0].GetY(), Vertices[0].GetZ());
GetMin().Set(Vertices[0].GetX(), Vertices[0].GetY(), Vertices[0].GetZ());
for(int i = 1; i < numVertices; i++)
{
if(Vertices[i].GetX() > GetMax().GetX())
{
GetMax().SetX(Vertices[i].GetX());
}
else if(Vertices[i].GetX() < GetMin().GetX())
{
GetMin().SetX(Vertices[i].GetX());
}
if(Vertices[i].GetY() > GetMax().GetY())
{
GetMax().SetY(Vertices[i].GetY());
}
else if(Vertices[i].GetY() < GetMin().GetY())
{
GetMin().SetY(Vertices[i].GetY());
}
if(Vertices[i].GetZ() > GetMax().GetZ())
{
GetMax().SetZ(Vertices[i].GetZ());
}
else if(Vertices[i].GetZ() < GetMin().GetZ())
{
GetMin().SetZ(Vertices[i].GetZ());
}
}
if(GetMax().GetX() > max.GetX())
{
max.SetX(GetMax().GetX());
}
if(GetMax().GetY() > max.GetY())
{
max.SetY(GetMax().GetY());
}
if(GetMax().GetZ() > max.GetZ())
{
max.SetZ(GetMax().GetZ());
}
if(GetMin().GetX() < min.GetX())
{
min.SetX(GetMin().GetX());
}
if(GetMin().GetY() < min.GetY())
{
min.SetY(GetMin().GetY());
}
if(GetMin().GetZ() < min.GetZ())
{
min.SetZ(GetMin().GetZ());
}
}
示例10: GetNode
public Node GetNode(Point c)
{
int TempX = (int) c.GetX();
int TempY = (int) c.GetY();
if(TempX >= 0 && TempX < xLength && TempY >= 0 && TempY < yLength) {
return GridArray[TempX, TempY];
}
return null;
}
示例11: Intersect
/**
* Intersect
*
* @param ray
* @param intersect
* @param Threshold
* @return OctNode
*/
public OctNode Intersect(Ray ray, Point intersect, double Threshold)
{
Vector delta = new Vector(0.0f, 0.0f, 0.0f);
double current = 0.0f;
double t;
int[] facehits = new int[3];
facehits[0] = -1;
facehits[1] = -1;
facehits[2] = -1;
OctNode adjacent = null;
Face[] OFaces = this.OctFaces;
Face MAXXF = OFaces[MAXX];
Face MAXYF = OFaces[MAXY];
Face MAXZF = OFaces[MAXZ];
Face MINXF = OFaces[MINX];
Face MINYF = OFaces[MINY];
Face MINZF = OFaces[MINZ];
if(ray.GetDirection().GetX() != 0.0)
{
t = -(ray.GetOrigin().GetX() - OctFaces[MAXX].GetVert(0).GetX()) / ray.GetDirection().GetX();
if(t > Threshold && t > current)
{
intersect.Combine(ray.GetOrigin(), ray.GetDirection(), 1.0f, t);
if((intersect.GetY() <= MAXYF.GetVert(0).GetY()) && (intersect.GetY() >= MINYF.GetVert(0).GetY()) &&
(intersect.GetZ() <= MAXZF.GetVert(0).GetZ()) && (intersect.GetZ() >= MINZF.GetVert(0).GetZ()))
{
current = t;
facehits[0] = MAXX;
delta.SetX(Threshold);
}
}
t = -(ray.GetOrigin().GetX() - OctFaces[MINX].GetVert(0).GetX()) / ray.GetDirection().GetX();
if(t > Threshold && t > current)
{
intersect.Combine(ray.GetOrigin(), ray.GetDirection(), 1.0f, t);
if((intersect.GetY() <= MAXYF.GetVert(0).GetY()) && (intersect.GetY() >= MINYF.GetVert(0).GetY()) &&
(intersect.GetZ() <= MAXZF.GetVert(0).GetZ()) && (intersect.GetZ() >= MINZF.GetVert(0).GetZ()))
{
current = t;
facehits[0] = MINX;
delta.SetX(-Threshold);
}
}
}
if(ray.GetDirection().GetY() != 0.0)
{
t = -(ray.GetOrigin().GetY() - OctFaces[MAXY].GetVert(0).GetY()) / ray.GetDirection().GetY();
if(t > Threshold)
{
if(t > current)
{
intersect.Combine(ray.GetOrigin(), ray.GetDirection(), 1.0f, t);
if((intersect.GetX() <= MAXXF.GetVert(0).GetX()) && (intersect.GetX() >= MINXF.GetVert(0).GetX()) &&
(intersect.GetZ() <= MAXZF.GetVert(0).GetZ()) && (intersect.GetZ() >= MINZF.GetVert(0).GetZ()))
{
current = t;
facehits[0] = MAXY;
delta.Set(0.0f, Threshold, 0.0f);
}
}
else if(t == current)
{
facehits[1] = MAXY;
delta.SetY(Threshold);
}
}
t = -(ray.GetOrigin().GetY() - OctFaces[MINY].GetVert(0).GetY()) / ray.GetDirection().GetY();
if(t > Threshold)
{
if(t > current)
{
intersect.Combine(ray.GetOrigin(), ray.GetDirection(), 1.0f, t);
if((intersect.GetX() <= MAXXF.GetVert(0).GetX()) && (intersect.GetX() >= MINXF.GetVert(0).GetX()) &&
(intersect.GetZ() <= MAXZF.GetVert(0).GetZ()) && (intersect.GetZ() >= MINZF.GetVert(0).GetZ()))
{
current = t;
facehits[0] = MINY;
delta.Set(0.0f, -Threshold, 0.0f);
}
}
else if(t == current)
{
facehits[1] = MINY;
delta.SetY(-Threshold);
}
}
}
if(ray.GetDirection().GetZ() != 0.0)
{
t = -(ray.GetOrigin().GetZ() - OctFaces[MAXZ].GetVert(0).GetZ()) / ray.GetDirection().GetZ();
//.........这里部分代码省略.........
示例12: Distance
public double Distance(Point @from, Point to)
{
return Distance(from, to.GetX(), to.GetY());
}
示例13: FindTreeNode
/**
* FindTreeNode
*
* @param point
* @return OctNode
*/
public OctNode FindTreeNode(Point point)
{
OctNode found;
if(point.GetX() < OctFaces[MINX].GetVert(0).GetX() || point.GetX() >= OctFaces[MAXX].GetVert(0).GetX())
{
return (null);
}
if(point.GetY() < OctFaces[MINY].GetVert(0).GetY() || point.GetY() >= OctFaces[MAXY].GetVert(0).GetY())
{
return (null);
}
if(point.GetZ() < OctFaces[MINZ].GetVert(0).GetZ() || point.GetZ() >= OctFaces[MAXZ].GetVert(0).GetZ())
{
return (null);
}
if(Child[0] != null)
{
for(int i = 0; i < 8; i++)
{
found = Child[i].FindTreeNode(point);
if(found != null)
{
return (found);
}
}
}
return (this);
}
示例14: OctNode
/**
* OctNode
*
* @param max
* @param min
*/
public OctNode(Point max, Point min)
{
Initialize();
CreateFaces(max.GetX(), min.GetX(), max.GetY(), min.GetY(), max.GetZ(), min.GetZ());
}
示例15: CreateChildren
/**
* CreateChildren
*
* @param objects
* @param depth
*/
private void CreateChildren(ObjNode objects, int depth)
{
double maxX = OctFaces[MAXX].GetVert(0).GetX();
double minX = OctFaces[MINX].GetVert(0).GetX();
double maxY = OctFaces[MAXY].GetVert(0).GetY();
double minY = OctFaces[MINY].GetVert(0).GetY();
double maxZ = OctFaces[MAXZ].GetVert(0).GetZ();
double minZ = OctFaces[MINZ].GetVert(0).GetZ();
Point midpt = new Point((maxX + minX) / 2.0f, (maxY + minY) / 2.0f, (maxZ + minZ) / 2.0f);
Point max = new Point();
Point min = new Point();
ObjNode currentnode;
int i;
max.Set(maxX, maxY, maxZ);
min.Set(midpt.GetX(), midpt.GetY(), midpt.GetZ());
Child[0] = new OctNode(max, min);
max.Set(maxX, midpt.GetY(), maxZ);
min.Set(midpt.GetX(), minY, midpt.GetZ());
Child[1] = new OctNode(max, min);
max.Set(maxX, midpt.GetY(), midpt.GetZ());
min.Set(midpt.GetX(), minY, minZ);
Child[2] = new OctNode(max, min);
max.Set(maxX, maxY, midpt.GetZ());
min.Set(midpt.GetX(), midpt.GetY(), minZ);
Child[3] = new OctNode(max, min);
max.Set(midpt.GetX(), maxY, maxZ);
min.Set(minX, midpt.GetY(), midpt.GetZ());
Child[4] = new OctNode(max, min);
max.Set(midpt.GetX(), midpt.GetY(), maxZ);
min.Set(minX, minY, midpt.GetZ());
Child[5] = new OctNode(max, min);
max.Set(midpt.GetX(), midpt.GetY(), midpt.GetZ());
min.Set(minX, minY, minZ);
Child[6] = new OctNode(max, min);
max.Set(midpt.GetX(), maxY, midpt.GetZ());
min.Set(minX, midpt.GetY(), minZ);
Child[7] = new OctNode(max, min);
OctNode[] adj = this.Adjacent;
OctNode[] chld = this.Child;
OctNode adj0 = adj[0];
OctNode adj1 = adj[1];
OctNode adj2 = adj[2];
OctNode adj3 = adj[3];
OctNode adj4 = adj[4];
OctNode adj5 = adj[5];
OctNode chld0 = chld[0];
OctNode chld1 = chld[1];
OctNode chld2 = chld[2];
OctNode chld3 = chld[3];
OctNode chld4 = chld[4];
OctNode chld5 = chld[5];
OctNode chld6 = chld[6];
OctNode chld7 = chld[7];
Child[0].FormAdjacent(adj0, adj1, adj2, chld4, chld1, chld3);
Child[1].FormAdjacent(adj0, chld0, adj2, chld5, adj4, chld2);
Child[2].FormAdjacent(adj0, chld3, chld1, chld6, adj4, adj5);
Child[3].FormAdjacent(adj0, adj1, chld0, chld7, chld2, adj5);
Child[4].FormAdjacent(chld0, adj1, adj2, adj3, chld5, chld7);
Child[5].FormAdjacent(chld1, chld4, adj2, adj3, adj4, chld6);
Child[6].FormAdjacent(chld2, chld7, chld5, adj3, adj4, adj5);
Child[7].FormAdjacent(chld3, adj1, chld4, adj3, chld6, adj5);
if(objects != null)
{
currentnode = objects;
}
else
{
currentnode = ObjList;
}
while(currentnode != null)
{
ObjectType currentobj = currentnode.GetObj();
for(i = 0; i < 8; i++)
{
OctNode cc = chld[i];
max = cc.GetFace(0).GetVert(0);
min = cc.GetFace(5).GetVert(3);
if(!((currentobj.GetMin().GetX() > max.GetX()) ||
(currentobj.GetMax().GetX() < min.GetX())))
{
if(!((currentobj.GetMin().GetY() > max.GetY()) ||
(currentobj.GetMax().GetY() < min.GetY())))
{
if(!((currentobj.GetMin().GetZ() > max.GetZ()) ||
(currentobj.GetMax().GetZ() < min.GetZ())))
{
ObjNode newnode = new ObjNode(currentobj, Child[i].GetList());
cc.SetList(newnode);
//.........这里部分代码省略.........