Exemplo n.º 1
0
        /// <inheritdoc />
        public override Vector3 GetNormalAt(Vector2 uv)
        {
            float u = uv.X;
            float v = uv.Y;

            if ((v >= -0.5f * (float)Math.PI) && (v < 0.0f))
            {
                return(startCap.GetNormalAt(new Vector2(u, v + 0.5f * (float)Math.PI)));
            }
            else if ((v >= 0.0f) && (v < 1.0f))
            {
                return(shaft.GetNormalAt(new Vector2(u, v)));
            }
            else if ((v >= 1.0f) && (v <= 1.0f + 0.5f * (float)Math.PI))
            {
                return(endCap.GetNormalAt(new Vector2(u, 1.0f + 0.5f * (float)Math.PI - v)));
            }
            else
            {
                throw new ArgumentOutOfRangeException("v", "'v' must be between [-0.5 pi] and [1.0 + 0.5 pi].");
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override dvec3 GetNormalAt(dvec2 uv)
        {
            DebugUtil.AssertAllFinite(uv, nameof(uv));
            double u = uv.x;
            double v = uv.y;

            if ((v >= -0.5 * Math.PI) && (v < 0.0))
            {
                return(startCap.GetNormalAt(new dvec2(u, v + 0.5 * Math.PI)));
            }
            else if ((v >= 0.0) && (v < 1.0))
            {
                return(shaft.GetNormalAt(new dvec2(u, v)));
            }
            else if ((v >= 1.0) && (v <= 1.0 + 0.5 * Math.PI))
            {
                return(endCap.GetNormalAt(new dvec2(u, 1.0 + 0.5 * Math.PI - v)));
            }
            else
            {
                throw new ArgumentOutOfRangeException("v", "'v' must be between [-0.5 pi] and [1.0 + 0.5 pi].");
            }
        }