日期:2014-05-16 浏览次数:20929 次
namespace BuildingLibrary
{
class PropertyLine
{
bool SharesEndpointWith(PropertyLine other)
{
XYZ startPoint = other.GetEndPoint(0);
XYZ endPoint = other.GetEndPoint(1);
return startPoint.ArePointsCoincident(m_startPoint) ||
endPoint.ArePointsCoincident(m_endPoint);
}
XYZ GetEndPoint(int index)
{
return (index == 0 ? m_startPoint : m_endPoint);
}
private XYZ m_startPoint;
private XYZ m_endPoint;
}
class XYZ
{
public bool ArePointsCoincident(XYZ otherXYZ)
{
return (X == otherXYZ.X && Y == otherXYZ.Y && Z == otherXYZ.Z);
}
public double X
{
get { return m_X; }
}
public double Y
{
get { return m_Y; }
}
public double Z
{
get { return m_Z; }
}
private double m_X, m_Y, m_Z;
}
}