コード例 #1
0
        public Vec3[] GetPositions()
        {
            var vecHeight = new Vec3(0, cone.Height, 0);
            var positions = new Vec3[cone.PointCount + 2];

            positions[0] = vecHeight / 2;
            positions[cone.PointCount + 1] = -vecHeight / 2;

            TesselationToolbox.GetCirclePointsOnXZPlane(-vecHeight / 2, cone.Radius, cone.PointCount, ref positions, 1);

            return(positions);
        }
コード例 #2
0
        public Vec3[] GetPositions()
        {
            var vecHeight = new Vec3(0, frustrumOfCone.Height, 0);
            var positions = new Vec3[frustrumOfCone.PointCount * 2 + 2];

            positions[0] = vecHeight / 2;
            positions[frustrumOfCone.PointCount * 2 + 1] = -vecHeight / 2;

            TesselationToolbox.GetCirclePointsOnXZPlane(vecHeight / 2, frustrumOfCone.Radius2,
                                                        frustrumOfCone.PointCount, ref positions, 1);
            TesselationToolbox.GetCirclePointsOnXZPlane(-vecHeight / 2, frustrumOfCone.Radius1,
                                                        frustrumOfCone.PointCount, ref positions,
                                                        frustrumOfCone.PointCount + 1);
            return(positions);
        }
コード例 #3
0
        public Vec3[] GetPositions()
        {
            var positions = new Vec3[sphere.CircleCount * sphere.PointsPerCircle + 2];
            var vecHeight = new Vec3(0, sphere.Radius, 0);

            positions[0] = vecHeight;
            positions[sphere.CircleCount * sphere.PointsPerCircle + 1] = -vecHeight;

            var step = (2 * vecHeight) / (sphere.CircleCount + 1);

            for (var i = 0; i < sphere.CircleCount; i++)
            {
                var vecHeightTmp = vecHeight - (i + 1) * step;
                var radiusTmp    = Math.Sqrt(sphere.Radius * sphere.Radius - vecHeightTmp.Length * vecHeightTmp.Length);

                TesselationToolbox.GetCirclePointsOnXZPlane(vecHeightTmp,
                                                            radiusTmp,
                                                            sphere.PointsPerCircle,
                                                            ref positions,
                                                            i * sphere.PointsPerCircle + 1);
            }

            return(positions);
        }