/// <summary> /// Create a new instance of the <see cref="HollowCylinder" />. /// </summary> /// <param name="radius">The radius of the cylinder.</param> /// <param name="height">The height of the cylinder.</param> /// <param name="segmentAngle">The angle of each of cegments of the cylinder.</param> /// <returns></returns> public static HollowCylinder Create(int radius, int height, int segmentAngle) { var hollowCylinder = new HollowCylinder { _radius = radius, _height = height, _segmentAngle = segmentAngle }; HollowCylinderBuilder.Build(radius, height, segmentAngle, hollowCylinder); return(hollowCylinder); }
/// <summary> /// Build a new <see cref="HollowCylinder" />. /// </summary> /// <param name="radius">The radius of the cylinder.</param> /// <param name="height">The height of the cylinder.</param> /// <param name="segmentAngle">The angle of segments of the cylinder.</param> /// <param name="hollowCylinder"></param> public static void Build(float radius, float height, float segmentAngle, HollowCylinder hollowCylinder) { if (radius <= float.Epsilon || segmentAngle <= float.Epsilon) return; if(hollowCylinder.UVs.Count == 0) AddTextureCoordinates(hollowCylinder); const float centerX = 0; const float centerY = 0; var initVerticesCount = hollowCylinder.Vertices.Count; foreach (var pos in GetPositionsForCircle(radius, centerX, centerY, segmentAngle)) AddFace(pos.X, pos.Y, height, hollowCylinder, 0, initVerticesCount); }
/// <summary> /// Create a new instance of the <see cref="HollowCylinder" />. /// </summary> /// <param name="radius">The radius of the cylinder.</param> /// <param name="height">The height of the cylinder.</param> /// <param name="segmentAngle">The angle of each of cegments of the cylinder.</param> /// <returns></returns> public static HollowCylinder Create(int radius, int height, int segmentAngle) { var hollowCylinder = new HollowCylinder {_radius = radius, _height = height, _segmentAngle = segmentAngle}; HollowCylinderBuilder.Build(radius, height, segmentAngle, hollowCylinder); return hollowCylinder; }