Example #1
0
        /**
         * Gets arrays {xyz,uvw,rgb} of cell coordinates, normals and colors. In
         * these arrays, the specified cells are represented by quads with specified
         * size, and colors corresponding to a property gotten from each cell.
         * @param size the size (in samples) of the quads.
         * @param cmap the colormap used to compute rgb colors from floats.
         * @param cells the cells for which to compute quads.
         * @param get1 used to get the float from a cell to be colormapped.
         * @param lhc true, if left-handed coordinate system; false, otherwise.
         * @return arrays {xyz,uvw,rgb}.
         */
        private static float[][] getXyzUvwRgb(
            float size, ColorMap cmap, FaultCell[] cells,
            Get1 get1, bool lhc)
        {
            FloatList xyz = new FloatList();
            FloatList uvw = new FloatList();
            FloatList fcl = new FloatList();

            size *= 0.5f;
            float[] qa = { 0.0f, -size, -size };
            float[] qb = { 0.0f, size, -size };
            float[] qc = { 0.0f, size, size };
            float[] qd = { 0.0f, -size, size };
            if (lhc)
            {
                float[] qt = qb; qb = qc; qc = qt;
                qt = qd; qa = qd; qd = qt;
            }
            foreach (FaultCell cell in cells)
            {
                float   x1 = cell.x1;
                float   x2 = cell.x2;
                float   x3 = cell.x3;
                float   w1 = cell.w1;
                float   w2 = cell.w2;
                float   w3 = cell.w3;
                float   fp = ArrayMath.toRadians(cell.fp);
                float   ft = ArrayMath.toRadians(cell.ft);
                float   cp = (float)Math.Cos(fp);
                float   sp = (float)Math.Sin(fp);
                float   ct = (float)Math.Cos(ft);
                float   st = (float)Math.Sin(ft);
                float[] ra = rotatePoint(cp, sp, ct, st, qa);
                float[] rb = rotatePoint(cp, sp, ct, st, qb);
                float[] rc = rotatePoint(cp, sp, ct, st, qc);
                float[] rd = rotatePoint(cp, sp, ct, st, qd);
                float   a1 = x1 + ra[0], a2 = x2 + ra[1], a3 = x3 + ra[2];
                float   b1 = x1 + rb[0], b2 = x2 + rb[1], b3 = x3 + rb[2];
                float   c1 = x1 + rc[0], c2 = x2 + rc[1], c3 = x3 + rc[2];
                float   d1 = x1 + rd[0], d2 = x2 + rd[1], d3 = x3 + rd[2];
                xyz.add(a3); xyz.add(a2); xyz.add(a1);
                xyz.add(b3); xyz.add(b2); xyz.add(b1);
                xyz.add(c3); xyz.add(c2); xyz.add(c1);
                xyz.add(d3); xyz.add(d2); xyz.add(d1);
                uvw.add(w3); uvw.add(w2); uvw.add(w1);
                uvw.add(w3); uvw.add(w2); uvw.add(w1);
                uvw.add(w3); uvw.add(w2); uvw.add(w1);
                uvw.add(w3); uvw.add(w2); uvw.add(w1);
                float fc = get1(cell);
                fcl.add(fc);
                fcl.add(fc);
                fcl.add(fc);
                fcl.add(fc);
            }
            float[] fc2 = fcl.trim();
            float[] rgb = cmap.getRgbFloats(fc2);
            return(new float[][] { xyz.trim(), uvw.trim(), rgb });
        }
Example #2
0
        public IEnumerable <WeatherForecast> Get()
        {
            IQuery <Ans> xs = new Get1();

            _queryProcessor.Process(new Get1(), default);

            var rng = new Random();

            return(Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = Summaries[rng.Next(Summaries.Length)]
            })
                   .ToArray());
        }