/// <summary> /// It creates a face of the cylinder /// </summary> private void GenerateCylinder() { var angle = Alpha; var cylinderRadius = CylinderRadius; // create up vertex for (var i = 0; i < ApproksimationValue; i++) { var angleR = angle * (Math.PI / 180.0); var x = cylinderRadius * Math.Cos(angleR); var z = cylinderRadius * Math.Sin(angleR); var y = UpCentexPosition; _upListVertex.Add(new Vertex(i, x + LeftCentexPosition, y, z, PointsType.Up)); angle += Alpha; } var lastNumber = _upListVertex.Count - 1; _upListVertex.Add(new Vertex(lastNumber + 1, _upListVertex[0].X, _upListVertex[0].Y, _upListVertex[0].Z, PointsType.Up)); // create down vertex var index = _upListVertex.Count - 1; foreach (var item in _upListVertex) { _downListVertex.Add(new Vertex(index += 1, item.X, item.Y + CylinderHeigth, item.Z, PointsType.Down)); } _facetLsit = (IList <IFacet>)DrawingFaces.GenerateFacets(_upListVertex, _downListVertex, nameof(Cylinder)); }
/// <summary> /// Create parallelepiped faces /// </summary> private void InitializationVertex() { var startPointX = LeftCentexPosition - (Width / 2); var startPointY = UpCenterPosition; var startPointZ = -Length / 2; _upListVertex = new List <IVertex>() { new Vertex { Number = 1, X = startPointX, Y = startPointY, Z = startPointZ, PointType = PointsType.Up }, new Vertex { Number = 2, X = startPointX, Y = startPointY, Z = startPointZ + Length, PointType = PointsType.Up }, new Vertex { Number = 3, X = startPointX + Width, Y = startPointY, Z = startPointZ + Length, PointType = PointsType.Up }, new Vertex { Number = 4, X = startPointX + Width, Y = startPointY, Z = startPointZ, PointType = PointsType.Up }, new Vertex { Number = 5, X = startPointX, Y = startPointY, Z = startPointZ, PointType = PointsType.Up } }; var index = _upListVertex.Count - 1; foreach (var item in _upListVertex) { _downListVertex.Add(new Vertex(index += 1, item.X, item.Y + Heigth, item.Z, PointsType.Down)); } _facetLsit = (IList <IFacet>)DrawingFaces.GenerateFacets(_upListVertex, _downListVertex, nameof(Parallelepiped)); }