/// <summary> /// Constructs a point by projecting a point on surface with given /// project direction. /// </summary> /// <param name="contextSurface">The surface on which the projection is to be made.</param> /// <param name="direction">The direction vector of the projection</param> /// <returns>Projected point on surface</returns> public Point Project(Surface contextSurface, Vector direction) { if (null == contextSurface) { throw new ArgumentNullException("contextSurface"); } if (null == direction || direction.IsZeroVector()) { throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, direction, "Project on surface"), "direction"); } Point pt = ProjectOnGeometry(contextSurface, direction); pt.Context = contextSurface; pt.Direction = direction; pt.ReferencePoint = this; double[] parameters = contextSurface.ParameterAtPoint(pt); if (null != parameters) { pt.U = parameters[0]; pt.V = parameters[1]; } return(pt); }
/// <summary> /// Constructs a point by projecting a point on surface. It is equivalent /// to finding the nearest point on the surface /// </summary> /// <param name="contextSurface">The surface on which the projection is to be made.</param> /// <returns>Projected point on surface</returns> public Point Project(Surface contextSurface) { if (null == contextSurface) { throw new ArgumentNullException("contextSurface"); } Point pt = ProjectOnGeometry(contextSurface, null); if (null == pt) { throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Project on surface")); } pt.Context = contextSurface; pt.ReferencePoint = this; double[] parameters = contextSurface.ParameterAtPoint(pt); if (null != parameters) { pt.U = parameters[0]; pt.V = parameters[1]; } return(pt); }
/// <summary> /// Constructs a point by projecting a point on surface with given /// project direction. /// </summary> /// <param name="contextSurface">The surface on which the projection is to be made.</param> /// <param name="direction">The direction vector of the projection</param> /// <returns>Projected point on surface</returns> public Point Project(Surface contextSurface, Vector direction) { if (null == contextSurface) throw new ArgumentNullException("contextSurface"); if (null == direction || direction.IsZeroVector()) throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, direction, "Project on surface"), "direction"); Point pt = ProjectOnGeometry(contextSurface, direction); pt.Context = contextSurface; pt.Direction = direction; pt.ReferencePoint = this; double[] parameters = contextSurface.ParameterAtPoint(pt); if (null != parameters) { pt.U = parameters[0]; pt.V = parameters[1]; } return pt; }
/// <summary> /// Constructs a point by projecting a point on surface. It is equivalent /// to finding the nearest point on the surface /// </summary> /// <param name="contextSurface">The surface on which the projection is to be made.</param> /// <returns>Projected point on surface</returns> public Point Project(Surface contextSurface) { if (null == contextSurface) throw new ArgumentNullException("contextSurface"); Point pt = ProjectOnGeometry(contextSurface, null); if (null == pt) throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Project on surface")); pt.Context = contextSurface; pt.ReferencePoint = this; double[] parameters = contextSurface.ParameterAtPoint(pt); if (null != parameters) { pt.U = parameters[0]; pt.V = parameters[1]; } return pt; }