Пример #1
0
        /// <summary>
        /// Gets the triangle vertex that is at the most extreme along the specified direction.
        /// </summary>
        /// <param name="d">A normalized direction vector.</param>
        /// <returns>Returns the most extreme vertex.</returns>
        public TriangleFeature ExtremeVertex(ref Vector3 d)
        {
            var feature = new TriangleFeature {
                Type = TriangleFeatureType.Vertex
            };
            float d1, d2, d3;

            Vector3.Dot(ref d, ref V1, out d1);
            Vector3.Dot(ref d, ref V2, out d2);
            Vector3.Dot(ref d, ref V3, out d3);
            if (d1 >= d2 && d1 >= d3)
            {
                feature.Index = 1; feature.X = d1;
            }
            else if (d2 >= d1 && d2 >= d3)
            {
                feature.Index = 2; feature.X = d2;
            }
            else
            {
                feature.Index = 3; feature.X = d3;
            }
            return(feature);
        }
Пример #2
0
		/// <summary>
		/// Gets the triangle vertex that is at the most extreme along the specified direction.
		/// </summary>
		/// <param name="d">A normalized direction vector.</param>
		/// <returns>Returns the most extreme vertex.</returns>
		public TriangleFeature ExtremeVertex(ref Vector3 d)
		{
			var feature = new TriangleFeature { Type = TriangleFeatureType.Vertex };
			float d1, d2, d3;
			Vector3.Dot(ref d, ref V1, out d1);
			Vector3.Dot(ref d, ref V2, out d2);
			Vector3.Dot(ref d, ref V3, out d3);
			if (d1 >= d2 && d1 >= d3)
			{ feature.Index = 1; feature.X = d1; }
			else if (d2 >= d1 && d2 >= d3)
			{ feature.Index = 2; feature.X = d2; }
			else
			{ feature.Index = 3; feature.X = d3; }
			return feature;
		}