Пример #1
0
        /// <summary>
        /// The base area of an aquarium (cm2).
        /// </summary>
        public override double CalcBaseArea()
        {
            double glassThickness = GlassThickness;
            double width          = Width;
            double centreWidth    = CentreWidth;
            double length         = Length;

            if (glassThickness > 0.0d)
            {
                double thicknessX2 = glassThickness * 2.0d;

                width       -= thicknessX2; // two sides
                centreWidth -= thicknessX2; // two sides
                length      -= thicknessX2; // two sides
            }

            double chordWidth = centreWidth - width;

            float radius, wedgeAngle;

            ALData.CalcSegmentParams((float)chordWidth, (float)length, out radius, out wedgeAngle);

            double segmSquare = (radius * radius * (wedgeAngle - Math.Sin(wedgeAngle))) / 2.0d;
            double rectSquare = (length * width);
            double baseArea   = segmSquare + rectSquare;

            return(baseArea);
        }
        // Draw an arc strip of a given height from y=0
        private void DrawBowfront(float x1, float x2, float z1, float width, float fullWidth, float height, out float centerZ, out IList <Point3D> points)
        {
            float chordLength = x2 - x1;
            float chordWidth  = fullWidth - width;

            float radius, wedgeAngle;

            ALData.CalcSegmentParams(chordWidth, chordLength, out radius, out wedgeAngle);
            wedgeAngle = (float)MathHelper.RadiansToDegrees(wedgeAngle);

            centerZ = (z1 + fullWidth - radius);
            Point3D p0         = new Point3D(0.0f, 0.0f, centerZ);
            Point3D p1         = new Point3D(x2, 0.0f, centerZ);
            Point3D p2         = new Point3D(x2, 0.0f, z1 + width);
            float   startAngle = Vector3D.GetAngle(p1.Sub(p0), p2.Sub(p0));

            fScene.PushMatrix();
            fScene.Translatef(0.0f, 0.0f, centerZ);
            points = GetArcPoints(30, radius, startAngle, wedgeAngle);
            DrawCylinder(points, height, radius);
            fScene.PopMatrix();
        }