Example #1
0
        internal void AddCone(Vector3 translation, Vector3 directionVec, Vector3 baseVec, int tessalation, Color color)
        {
            var axis = directionVec;

            axis.Normalize();

            var apex = translation + directionVec;

            var steps    = tessalation;
            var stepsRcp = (float)(Math.PI * 2 / steps);

            for (int i = 0; i < 32; i++)
            {
                float a0 = i * stepsRcp;
                float a1 = (i + 1) * stepsRcp;

                var A = translation + Vector3.Transform(baseVec, Matrix.CreateFromAxisAngle(axis, a0));
                var B = translation + Vector3.Transform(baseVec, Matrix.CreateFromAxisAngle(axis, a1));

                Add(A, B, color);
                Add(A, apex, color);
            }
        }