Example #1
0
        public static Bowl CreateFlatRimmedBowl(double innerRadius,
                                                double outerRadius,
                                                IMaterial material)
        {
            ConvexPartSphere o = new ConvexPartSphere(new Vec3(),
                                                      outerRadius,
                                                      0, 360, 90, 180);
            ConvexPartSphere i = new ConvexPartSphere(new Vec3(),
                                                      innerRadius,
                                                      0, 360, 90, 180);
            Annulus a = new Annulus(new Vec3(),
                                    new Vec3(0, 1, 0),
                                    innerRadius,
                                    outerRadius);

            Bowl b = new Bowl();

            b.AddObject(o);
            b.AddObject(i);
            b.AddObject(a);

            b.bbox = new BBox(-outerRadius, outerRadius,
                              -outerRadius, outerRadius,
                              -outerRadius, outerRadius);

            b.Material = material;

            return(b);
        }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Aperture.GetHashCode();
         hashCode = (hashCode * 397) ^ Gap.GetHashCode();
         hashCode = (hashCode * 397) ^ Annulus.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)Type;
         return(hashCode);
     }
 }
    public static void annulus_sector_centroid_2d_test( )

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    ANNULUS_SECTOR_CENTROID_2D_TEST tests ANNULUS_SECTOR_CENTROID_2D.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    02 December 2005
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double[]     pc = { 5.0, 3.0 };
        const double r1 = 2.0;
        const double r2 = 3.0;

        double theta1 = Helpers.degrees_to_radians(30.0);
        double theta2 = Helpers.degrees_to_radians(60.0);

        Console.WriteLine("");
        Console.WriteLine("ANNULUS_SECTOR_CENTROID_2D_TEST");
        Console.WriteLine("  ANNULUS_SECTOR_CENTROID_2D computes the centroid of a");
        Console.WriteLine("  circular annulus.");
        Console.WriteLine("");
        Console.WriteLine("  The circle has center        " + pc[0]
                          + "  " + pc[1] + "");
        Console.WriteLine("  The inner radius is R1 =     " + r1 + "");
        Console.WriteLine("  The outer radius is R2 =     " + r2 + "");
        Console.WriteLine("  The first angle is THETA1 =  " + theta1 + "");
        Console.WriteLine("  The second angle is THETA2 = " + theta2 + "");

        double[] centroid = Annulus.annulus_sector_centroid_2d(pc, r1, r2, theta1, theta2);

        Console.WriteLine("");
        Console.WriteLine("  Centroid: "
                          + centroid[0].ToString(CultureInfo.InvariantCulture).PadLeft(12)
                          + centroid[1].ToString(CultureInfo.InvariantCulture).PadLeft(12) + "");
    }
Example #4
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          500);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(100, 100, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(ColorUtils.BLUE);
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.4f);
            m.SetExp(64.0f);

            Annulus an = new Annulus(new Vec3(),
                                     new Vec3(0, 1, 0), 55, 80);

            an.Material = m;

            AddObject(an);
        }
Example #5
0
        public static Bowl Create(double innerRadius,
                                  double outerRadius,
                                  bool roundRimmedBowl,
                                  IMaterial material)
        {
            ConvexPartSphere o = new ConvexPartSphere(new Vec3(),
                                                      outerRadius,
                                                      0, 360, 90, 180);
            ConvexPartSphere i = new ConvexPartSphere(new Vec3(),
                                                      innerRadius,
                                                      0, 360, 90, 180);

            Bowl b = new Bowl();

            b.AddObject(o);
            b.AddObject(i);

            if (roundRimmedBowl)
            {
                Torus t = new Torus((outerRadius + innerRadius) / 2,
                                    (outerRadius - innerRadius) / 2);
                b.AddObject(t);
            }
            else
            {
                Annulus a = new Annulus(new Vec3(),
                                        new Vec3(0, 1, 0),
                                        innerRadius,
                                        outerRadius);
                b.AddObject(a);
            }

            b.bbox = new BBox(-outerRadius, outerRadius,
                              -outerRadius, outerRadius,
                              -outerRadius, outerRadius);

            b.Material = material;

            return(b);
        }