예제 #1
0
        public static IStrategy CreateSTRG(MappingMode mode = MappingMode.All)
        {
            var strategy = new Strategy(mode);

            StrategyContainer.Inst.Add(strategy);
            return(strategy);
        }
예제 #2
0
 public Strategy(MappingMode mode = MappingMode.All)
 {
     this.key    = Guid.NewGuid();
     this.mode   = mode;
     MappingList = new List <Pair>();
     FilterList  = null;
 }
예제 #3
0
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     PDF axial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="BBoxLeft">Bounding box left position</param>
        /// <param name="BBoxBottom">Bounding box bottom position</param>
        /// <param name="BBoxWidth">Bounding box width</param>
        /// <param name="BBoxHeight">Bounding box height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfAxialShading
        (
            PdfDocument Document,
            double BBoxLeft,
            double BBoxBottom,
            double BBoxWidth,
            double BBoxHeight,
            PdfShadingFunction ShadingFunction
        ) : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "2");

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);

            // bounding box
            this.BBoxLeft   = BBoxLeft;
            this.BBoxBottom = BBoxBottom;
            BBoxRight       = BBoxLeft + BBoxWidth;
            BBoxTop         = BBoxBottom + BBoxHeight;

            // assume the direction of color change is along x axis
            Mapping     = MappingMode.Relative;
            StartPointX = 0.0;
            StartPointY = 0.0;
            EndPointX   = 1.0;
            EndPointY   = 0.0;
        }
예제 #4
0
 public TableMapping(DataRow row)
 {
     this.Id          = (int)row["Id"];
     this.TableId     = (string)row["TableId"];
     this.ColName     = (string)row["ColName"];
     this.MappingName = (string)row["MappingName"];
     this.Mode        = (MappingMode)(int)row["MappingMode"];
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StackTexture"/> class.
 /// </summary>
 /// <param name="TexturePath">The texture path.</param>
 /// <param name="Channel">The uv channel used by the texture.</param>
 /// <param name="MappingModeU">The U mapping mode.</param>
 /// <param name="MappingModeV">The V mapping mode.</param>
 /// <param name="Alpha">The alpha of the node.</param>
 /// <param name="Blend">The blending coefficient of the node.</param>
 /// <param name="Flags">The flags of the node.</param>
 public StackTexture(String TexturePath, int Channel, MappingMode MappingModeU, MappingMode MappingModeV, float Alpha = 1.0f, float Blend = 1.0F, int Flags = 0)
     : base(Alpha, Blend, Flags, StackType.Texture)
 {
     texturePath  = TexturePath;
     channel      = Channel;
     mappingModeU = MappingModeU;
     mappingModeV = MappingModeV;
 }
예제 #6
0
        /// <summary>
        /// set
        /// </summary>
        /// <param name="mode"></param>
        public void SetMode(MappingMode mode)
        {
            bool androidChecked = (MappingMode.Android == mode);

            _itemModeAndroid.Checked      = androidChecked;
            _itemModeVisualStudio.Checked = !androidChecked;
            this.SetNotifyIcon();
        }
예제 #7
0
 private void rbSearch_CheckedChanged(object sender, EventArgs e)
 {
     if (rbSearch.Checked == true)
     {
         rbMapped_CheckedChanged(sender, e);
         cbSearchMode.Enabled = true;
         mode = MappingMode.Search;
     }
 }
예제 #8
0
 private void ResetFields(bool state)
 {
     mode                   = MappingMode.Lookup;
     lblPath.Text           = string.Empty;
     txtLibraryPath.Enabled = state;
     txtLibraryPath.Clear();
     btnBrowse.Enabled    = state;
     cbSearchMode.Enabled = state;
 }
예제 #9
0
        static void AddMapping(Configuration cfg, MappingMode mode)
        {
            switch (mode)
            {
                case MappingMode.Conventional:
                    AddConventionalMapping(cfg);
                    break;

                case MappingMode.Static:
                    AddStaticMapping(cfg);
                    break;
            }
        }
예제 #10
0
 /// <summary>
 ///     Set gradient axis direction
 /// </summary>
 /// <param name="StartPointX">Start point x</param>
 /// <param name="StartPointY">Start point y</param>
 /// <param name="EndPointX">End point x</param>
 /// <param name="EndPointY">End point y</param>
 /// <param name="Mapping">Mapping mode (Relative or Absolute)</param>
 public void SetAxisDirection
 (
     double StartPointX,
     double StartPointY,
     double EndPointX,
     double EndPointY,
     MappingMode Mapping
 )
 {
     this.StartPointX = StartPointX;
     this.StartPointY = StartPointY;
     this.EndPointX   = EndPointX;
     this.EndPointY   = EndPointY;
     this.Mapping     = Mapping;
 }
        public override int GetHashCode()
        {
            var hashCode = base.GetHashCode();

            unchecked {
                foreach (var stop in GradientStops)
                {
                    hashCode = hashCode * -1521134295 + stop.GetHashCode();
                }
                hashCode = hashCode * -1521134295 + ColorInterpolationMode.GetHashCode();
                hashCode = hashCode * -1521134295 + MappingMode.GetHashCode();
                hashCode = hashCode * -1521134295 + SpreadMethod.GetHashCode();
            }
            return(hashCode);
        }
예제 #12
0
        private void rbDirect_CheckedChanged(object sender, EventArgs e)
        {
            if (rbDirect.Checked == true)
            {
                ResetFields(true);

                mode                   = MappingMode.Direct;
                lblPath.Text           = "Library Path";
                txtLibraryPath.Enabled = false;
                btnBrowse.Enabled      = false;
                cbSearchMode.Enabled   = false;

                txtLibraryPath.Text = Main.sourceLibraryFolderPath;
            }
        }
예제 #13
0
        private void rbMapped_CheckedChanged(object sender, EventArgs e)
        {
            if (rbMapped.Checked == true)
            {
                ResetFields(true);

                mode                 = MappingMode.Mapped;
                lblPath.Text         = "Library Path";
                cbSearchMode.Enabled = false;

                if (!string.IsNullOrEmpty(Properties.Settings.Default.lastLibraryFolderPath))
                {
                    txtLibraryPath.Text = Properties.Settings.Default.lastLibraryFolderPath;
                }
            }
        }
예제 #14
0
        public static string GetString(this MappingMode mode)
        {
            var str = "空白列";

            switch (mode)
            {
            case MappingMode.Custom:
                str = "定制列";
                break;

            case MappingMode.Frozen:
                str = "固定列";
                break;
            }
            return(str);
        }
예제 #15
0
 /// <summary>
 ///     Set gradient direction
 /// </summary>
 /// <param name="StartCenterX">Start circle center x position</param>
 /// <param name="StartCenterY">Start circle center y position</param>
 /// <param name="StartRadius">Start circle center radius</param>
 /// <param name="EndCenterX">End circle center x position</param>
 /// <param name="EndCenterY">End circle center y position</param>
 /// <param name="EndRadius">End circle center radius</param>
 /// <param name="Mapping">Mapping mode (relative absolute)</param>
 public void SetGradientDirection
 (
     double StartCenterX,
     double StartCenterY,
     double StartRadius,
     double EndCenterX,
     double EndCenterY,
     double EndRadius,
     MappingMode Mapping
 )
 {
     this.StartCenterX = StartCenterX;
     this.StartCenterY = StartCenterY;
     this.StartRadius  = StartRadius;
     this.EndCenterX   = EndCenterX;
     this.EndCenterY   = EndCenterY;
     this.EndRadius    = EndRadius;
     this.Mapping      = Mapping;
 }
예제 #16
0
파일: LightItem.cs 프로젝트: cyx233/403ALab
 public static void ToggleMode()
 {
     ResetIntensity();
     if (mode == MappingMode.Direct)
     {
         mode = MappingMode.InvDistance;
     }
     else if (mode == MappingMode.InvDistance)
     {
         mode = MappingMode.ExpDistance;
     }
     else if (mode == MappingMode.ExpDistance)
     {
         mode = MappingMode.SightExpDistance;
     }
     else if (mode == MappingMode.SightExpDistance)
     {
         mode = MappingMode.Direct;
     }
 }
예제 #17
0
        private void rbLookup_CheckedChanged(object sender, EventArgs e)
        {
            if (rbLookup.Checked == true)
            {
                ResetFields(false);

                mode                   = MappingMode.Lookup;
                lblPath.Text           = "f2k JSON file";
                txtLibraryPath.Enabled = true;
                btnBrowse.Enabled      = true;
                lblAboutLookup.Visible = true;

                if (!string.IsNullOrEmpty(Properties.Settings.Default.lastLookupJsonPath))
                {
                    txtLibraryPath.Text = Properties.Settings.Default.lastLookupJsonPath;
                }
            }
            else
            {
                lblAboutLookup.Visible = false;
            }
        }
예제 #18
0
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF radial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="BBoxLeft">Bounding box left position</param>
        /// <param name="BBoxBottom">Bounding box bottom position</param>
        /// <param name="BBoxWidth">Bounding box width</param>
        /// <param name="BBoxHeight">Bounding box height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfRadialShading
        (
            PdfDocument Document,
            double BBoxLeft,
            double BBoxBottom,
            double BBoxWidth,
            double BBoxHeight,
            PdfShadingFunction ShadingFunction
        ) : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "3");

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);

            // bounding box
            this.BBoxLeft   = BBoxLeft;
            this.BBoxBottom = BBoxBottom;
            this.BBoxRight  = BBoxLeft + BBoxWidth;
            this.BBoxTop    = BBoxBottom + BBoxHeight;

            // assume the direction of color change is along x axis
            this.Mapping      = MappingMode.Relative;
            this.StartCenterX = 0.5;
            this.StartCenterY = 0.5;
            this.StartRadius  = 0.0;
            this.EndCenterX   = 0.5;
            this.EndCenterY   = 0.5;
            this.EndRadius    = Math.Sqrt(0.5);
            return;
        }
예제 #19
0
        /// <summary>
        /// Create an object given destination type and do the property mappings
        /// </summary>
        /// <param name="mappingMode"></param>
        /// <param name="destinationType"></param>
        /// <param name="sourceType"></param>
        /// <param name="sourceObj"></param>
        /// <param name="destinationObj"></param>
        /// <returns></returns>
        public virtual object Map(MappingMode mappingMode, Type destinationType, Type sourceType, object sourceObj, object destinationObj = null)
        {
            _mappingMode     = mappingMode;
            _destinationType = destinationType;
            _sourceType      = sourceType;
            _sourceObj       = sourceObj;

            // If Type is primitive then use BasicTypeConverter
            if (destinationType.IsPrimitiveSystemType() && !destinationType.IsIEnumerableType())
            {
                return(BasicTypeConverter(destinationType, sourceObj));
            }

            // Instantiate destination object if it is null
            _result = destinationObj ?? _destinationType.Instantiate();

            _mappingDictionary = MappingDictionary();

            _mappingDictionary.ForEach(x =>
            {
                var value = GetPropertyValue(x.Value);

                // recurisve step if type is complex type
                if (x.Value.IsComplexType)
                {
                    value = LoopBackMapper(x.Key.PropertyType, x.Value.PropertyType, value);
                }

                // No setting values when running on merge mode and value was null
                if (value != null || _mappingMode != MappingMode.Merge)
                {
                    SetPropertyValue(x.Key, value);
                }
            });

            return(_result);
        }
예제 #20
0
        public Chroma(IAudioStream stream, int windowSize, int hopSize, WindowType windowType, float minFreq, float maxFreq, bool normalize, MappingMode mappingMode)
            : base(stream, windowSize, hopSize, windowType, OutputFormat.MagnitudesSquared)
        {
            fftFrameBuffer = new float[windowSize / 2];

            // Precompute FFT bin to Chroma bin mapping
            double freqToBinRatio = (double)stream.Properties.SampleRate / windowSize;
            int    minBin         = (int)Math.Floor(minFreq / freqToBinRatio);
            int    maxBin         = (int)Math.Ceiling(maxFreq / freqToBinRatio);

            minBin = Math.Max(minBin, 1); // skip bin 0 in any case (zero f cannot be converted to chroma)
            maxBin = Math.Min(maxBin, fftFrameBuffer.Length - 1);

            fftToChromaBinMapping       = new int[maxBin - minBin];
            fftToChromaBinMappingOffset = minBin;
            fftToChromaBinCount         = new int[Bins];

            if (mappingMode == MappingMode.Paper)
            {
                for (int i = minBin; i < maxBin; i++)
                {
                    double fftBinCenterFreq = i * freqToBinRatio;
                    double c = Math.Log(fftBinCenterFreq, 2) - Math.Floor(Math.Log(fftBinCenterFreq, 2)); // paper formula (3)
                    // c ∈ [0, 1) must be mapped to chroma bins {0...11}
                    // The paper says that the first class is centered around 0. This means that the first class has only half the
                    // size of the others, but also that there's a 13. class (index 12) at the upper end of c. Therefore, we wrap
                    // around the edges with modulo and put the lower and upper end into bin 0, making them all the same size.
                    int chromaBin = (int)Math.Round(c * Bins) % Bins;
                    fftToChromaBinMapping[i - minBin] = chromaBin;
                    fftToChromaBinCount[chromaBin]++; // needed to take the arithmetic mean in formula (6)
                }
            }
            else if (mappingMode == MappingMode.Chromaprint)
            {
                double A0 = 440.0 / 16.0; // Hz
                for (int i = minBin; i < maxBin; i++)
                {
                    double fftBinCenterFreq = i * freqToBinRatio;
                    double c         = Math.Log(fftBinCenterFreq / A0, 2) - Math.Floor(Math.Log(fftBinCenterFreq / A0, 2)); // Chromaprint additionally divides by A0 - WHY?
                    int    chromaBin = (int)(c * Bins);                                                                     // Chromaprint does the mapping more bluntly
                    fftToChromaBinMapping[i - minBin] = chromaBin;
                    fftToChromaBinCount[chromaBin]++;                                                                       // needed to take the arithmetic mean in formula (6)
                }
            }
            else
            {
                throw new ArgumentException("unknown chroma mapping mode " + mappingMode);
            }

            this.normalize = normalize;
        }
예제 #21
0
        /// <summary>
        /// At a resolution determined by <paramref name="gridSize"/>, determine the relative traffic of all areas in the experiment.
        /// </summary>
        /// <param name="gridSize">The width and height of the grid the experiment should be superimposed upon.</param>
        /// <param name="maxTime">The amount of seconds within the simulation to include when making the grid (up until the end of the simluation)</param>
        /// <param name="mode">The type of mapping to perform between vertices on the grid and the bots</param>
        /// <returns>Traffic grid</returns>
        /// <remarks>
        /// Weighted at 1 unit of weight per second.
        /// </remarks>
        protected Tuple <float[][], float[][][]> ProjectBoidsToGrid(int gridSize = 21, float maxTime = float.PositiveInfinity, MappingMode mode = MappingMode.SAME_QUAD)
        {
            // Initialization
            float[][]   trafficGrid = new float[gridSize][];
            float[][][] pathGrid    = new float[gridSize][][];
            float[][]   weightGrid  = new float[gridSize][];
            for (int row = 0; row < gridSize; row++)
            {
                trafficGrid[row] = new float[gridSize];
                pathGrid[row]    = new float[gridSize][];
                weightGrid[row]  = new float[gridSize];
                for (int col = 0; col < gridSize; col++)
                {
                    trafficGrid[row][col] = 0;
                    float[] zeroVector = { 0, 0, 0 };
                    pathGrid[row][col]   = zeroVector;
                    weightGrid[row][col] = 0;
                }
            }

            if (mode == MappingMode.SAME_QUAD)
            {
                // Add weights
                for (int i = 0; i < Current.Count - 1; i++)
                {
                    BoidsSnapshot snapshot = Current[i];
                    if (snapshot.Timestamp < maxTime) // Since the list is not garunteed to be sorted, we can't break when we pass the max time.
                    {
                        for (int j = 0; j < snapshot.Coords.Count; j++)
                        {
                            float[] coord     = snapshot.Coords[j];
                            float[] direction =
                            {
                                Current[i + 1].Coords[j][0] - snapshot.Coords[j][0], // x
                                Current[i + 1].Coords[j][1] - snapshot.Coords[j][1], // y
                                0                                                    // z
                            };
                            DistributeBoidWeightOverQuad(ref trafficGrid, ref pathGrid, coord, direction, ref weightGrid, DeltaTime[i]);
                        }
                    }
                }
                // Special case for last snapshot; no next vector direction, so vector must be either considered zero or set to the last vector for that boid.
                BoidsSnapshot lastSnapshot = Current[Current.Count - 1];
                if (lastSnapshot.Timestamp < maxTime)
                {
                    for (int j = 0; j < lastSnapshot.Coords.Count; j++)
                    {
                        float[] coord     = lastSnapshot.Coords[j];
                        float[] direction = { 0, 0, 0 };
                        DistributeBoidWeightOverQuad(ref trafficGrid, ref pathGrid, coord, direction, ref weightGrid, DeltaTime[Current.Count - 1]);
                    }
                }
            }
            else if (mode == MappingMode.ALL_QUAD)
            {
                throw new System.NotImplementedException("Mapping mode not supported: All quads.");
            }

            return(new Tuple <float[][], float[][][]>(trafficGrid, pathGrid));
        }
예제 #22
0
 public TableMapping(string empcol)
 {
     Mode        = MappingMode.UnKnown;
     MappingName = empcol;
     ColName     = empcol;
 }
예제 #23
0
 // Save current state (only persistent over a single session)
 void SaveState()
 {
     lastMappingMode    = mode;
     lastEntryFilter    = (EntryFilter)cbFilter.SelectedValue;
     lastEntryFilterNot = chkEntryFilterNot.Checked;
 }
예제 #24
0
        public static void Map3D(MappingMode mappingMode, Double[,,] array, ImplicitModuleBase module, MappingRanges ranges)
        {
            var width  = array.GetLength(0);
            var height = array.GetLength(1);
            var depth  = array.GetLength(2);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    for (var z = 0; z < depth; ++z)
                    {
                        var    p = x / (double)width;
                        var    q = y / (double)height;
                        var    r = z / (double)depth;
                        double nx;
                        double ny;
                        double nz;
                        double nw;
                        double nu;
                        double dx;
                        double dy;
                        double dz;
                        var    val = 0.0;

                        switch (mappingMode)
                        {
                        case MappingMode.SeamlessNone:
                            dx  = ranges.MapX1 - ranges.MapX0;
                            dy  = ranges.MapY1 - ranges.MapY0;
                            dz  = ranges.MapZ1 - ranges.MapZ0;
                            nx  = ranges.MapX0 + p * dx;
                            ny  = ranges.MapY0 + q * dy;
                            nz  = ranges.MapZ0 + r * dz;
                            val = module.Get(nx, ny, nz);
                            break;

                        case MappingMode.SeamlessX:
                            dx  = ranges.LoopX1 - ranges.LoopX0;
                            dy  = ranges.MapY1 - ranges.MapY0;
                            dz  = ranges.MapZ1 - ranges.MapZ0;
                            p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                            nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                            ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                            nz  = ranges.MapY0 + q * dy;
                            nw  = ranges.MapZ0 + depth * dz;
                            val = module.Get(nx, ny, nz, nw);
                            break;

                        case MappingMode.SeamlessY:
                            dx  = ranges.MapX1 - ranges.MapX0;
                            dy  = ranges.LoopY1 - ranges.LoopY0;
                            dz  = ranges.MapZ1 - ranges.MapZ0;
                            q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                            nx  = ranges.MapX0 + p * dx;
                            ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                            nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                            nw  = ranges.MapZ0 + r * dz;
                            val = module.Get(nx, ny, nz, nw);
                            break;

                        case MappingMode.SeamlessZ:
                            dx  = ranges.MapX1 - ranges.MapX0;
                            dy  = ranges.MapY1 - ranges.MapY0;
                            dz  = ranges.LoopZ1 - ranges.LoopZ0;
                            r   = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                            nx  = ranges.MapX0 + p * dx;
                            ny  = ranges.MapY0 + q * dy;
                            nz  = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                            nw  = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                            val = module.Get(nx, ny, nz, nw);
                            break;

                        case MappingMode.SeamlessXY:
                            dx  = ranges.LoopX1 - ranges.LoopX0;
                            dy  = ranges.LoopY1 - ranges.LoopY0;
                            dz  = ranges.MapZ1 - ranges.MapZ0;
                            p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                            q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                            nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                            ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                            nz  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                            nw  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                            nu  = ranges.MapZ0 + r * dz;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;

                        case MappingMode.SeamlessXZ:
                            dx  = ranges.LoopX1 - ranges.LoopX0;
                            dy  = ranges.MapY1 - ranges.MapY0;
                            dz  = ranges.LoopZ1 - ranges.LoopZ0;
                            p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                            r   = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                            nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                            ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                            nz  = ranges.MapY0 + q * dy;
                            nw  = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                            nu  = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;

                        case MappingMode.SeamlessYZ:
                            dx  = ranges.MapX1 - ranges.MapX0;
                            dy  = ranges.LoopY1 - ranges.LoopY0;
                            dz  = ranges.LoopZ1 - ranges.LoopZ0;
                            q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                            r   = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                            nx  = ranges.MapX0 + p * dx;
                            ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                            nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                            nw  = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                            nu  = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;

                        case MappingMode.SeamlessXYZ:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            p  = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                            q  = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                            r  = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                            nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                            ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                            nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                            nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                            nu = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                            double nv = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                            val = module.Get(nx, ny, nz, nw, nu, nv);
                            break;
                        }
                        array[x, y, z] = val;
                    }
                }
            }
        }
예제 #25
0
 /// <summary>
 /// Maps an object of type object to given static type
 /// </summary>
 /// <param name="sourceObj"></param>
 /// <param name="destinationObj"></param>
 /// <param name="mapingMode"></param>
 /// <returns></returns>
 public static T Map <T>(object sourceObj, object destinationObj = null, MappingMode mapingMode = MappingMode.Map)
 {
     return((T)MapBuilder.RecursiveMap(typeof(T), sourceObj?.GetType(), sourceObj, destinationObj, mapingMode));
 }
예제 #26
0
파일: HDc.cs 프로젝트: snarfblam/editroid
 public MappingMode SetMapMode(MappingMode mode)
 {
     return(Gdi.SetMapMode(this, mode));
 }
예제 #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StackTexture"/> class.
 /// </summary>
 /// <param name="TexturePath">The texture path.</param>
 /// <param name="Channel">The uv channel used by the texture.</param>
 /// <param name="MappingModeU">The U mapping mode.</param>
 /// <param name="MappingModeV">The V mapping mode.</param>
 /// <param name="Alpha">The alpha of the node.</param>
 /// <param name="Blend">The blending coefficient of the node.</param>
 /// <param name="Flags">The flags of the node.</param>
 public StackTexture(String TexturePath, int Channel, MappingMode MappingModeU, MappingMode MappingModeV, float Alpha = 1.0f, float Blend = 1.0F, int Flags = 0)
     : base(Alpha, Blend, Flags, StackType.Texture)
 {
     texturePath = TexturePath;
     channel = Channel;
     mappingModeU = MappingModeU;
     mappingModeV = MappingModeV;
 }
예제 #28
0
        public static void Map2DNoZ(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges)
        {
            var width  = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var    p = x / (Double)width;
                    var    q = y / (Double)height;
                    Double nx;
                    Double ny;
                    Double nz;
                    Double dx;
                    Double dy;
                    var    val = 0.00;
                    switch (mappingMode)
                    {
                    case MappingMode.SeamlessNone:
                        nx  = ranges.MapX0 + p * (ranges.MapX1 - ranges.MapX0);
                        ny  = ranges.MapY0 + q * (ranges.MapY1 - ranges.MapY0);
                        val = module.Get(nx, ny);
                        break;

                    case MappingMode.SeamlessX:
                        dx  = ranges.LoopX1 - ranges.LoopX0;
                        dy  = ranges.MapY1 - ranges.MapY0;
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.MapY0 + q * dy;
                        val = module.Get(nx, ny, nz);
                        break;

                    case MappingMode.SeamlessY:
                        dx  = ranges.MapX1 - ranges.MapX0;
                        dy  = ranges.LoopY1 - ranges.LoopY0;
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.MapX0 + p * dx;
                        ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        val = module.Get(nx, ny, nz);
                        break;

                    case MappingMode.SeamlessXY:
                        dx = ranges.LoopX1 - ranges.LoopX0;
                        dy = ranges.LoopY1 - ranges.LoopY0;
                        p  = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        q  = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        Double nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        val = module.Get(nx, ny, nz, nw);
                        break;
                    }
                    array[x, y] = val;
                }
            }
        }
예제 #29
0
        /// <summary>
        /// Recurisve mapper
        /// </summary>
        /// <param name="destinationType"></param>
        /// <param name="sourceType"></param>
        /// <param name="sourceObj"></param>
        /// <param name="destinationObj"></param>
        /// <param name="mappingMode"></param>
        /// <returns></returns>
        public object RecursiveMap(Type destinationType, Type sourceType, object sourceObj, object destinationObj = null, MappingMode mappingMode = MappingMode.Map)
        {
            // test for edge cases
            if (ValidateEdgeCases(destinationType, sourceType, sourceObj, out var result))
            {
                return(result);
            }

            var mapper = _specialMappers.FirstOrDefault(x => x.MatchingMapper(destinationType, destinationType, sourceObj));

            return(mapper != null?mapper.New().Map(mappingMode, destinationType, sourceType, sourceObj, destinationObj) : _baseMapper.New().Map(mappingMode, destinationType, sourceType, sourceObj, destinationObj));
        }
예제 #30
0
 public MappingModeChangedEventArgs(MappingMode mode)
 {
     this.Mode = mode;
 }
예제 #31
0
        public static void Map3D(MappingMode mappingMode, Double[, ,] array, ImplicitModuleBase module, MappingRanges ranges)
        {
            var width = array.GetLength(0);
            var height = array.GetLength(1);
            var depth = array.GetLength(2);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    for (var z = 0; z < depth; ++z)
                    {
                        var p = x / (Double)width;
                        var q = y / (Double)height;
                        var r = z / (Double)depth;
                        Double nx;
                        Double ny;
                        Double nz;
                        Double nw;
                        Double nu;
                        Double dx;
                        Double dy;
                        Double dz;
                        var val = 0.0;

                        switch (mappingMode)
                        {
                            case MappingMode.SeamlessNone:
                                dx = ranges.MapX1 - ranges.MapX0;
                                dy = ranges.MapY1 - ranges.MapY0;
                                dz = ranges.MapZ1 - ranges.MapZ0;
                                nx = ranges.MapX0 + p * dx;
                                ny = ranges.MapY0 + q * dy;
                                nz = ranges.MapZ0 + r * dz;
                                val = module.Get(nx, ny, nz);
                                break;
                            case MappingMode.SeamlessX:
                                dx = ranges.LoopX1 - ranges.LoopX0;
                                dy = ranges.MapY1 - ranges.MapY0;
                                dz = ranges.MapZ1 - ranges.MapZ0;
                                p = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                                nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                                ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                                nz = ranges.MapY0 + q * dy;
                                nw = ranges.MapZ0 + depth * dz;
                                val = module.Get(nx, ny, nz, nw);
                                break;
                            case MappingMode.SeamlessY:
                                dx = ranges.MapX1 - ranges.MapX0;
                                dy = ranges.LoopY1 - ranges.LoopY0;
                                dz = ranges.MapZ1 - ranges.MapZ0;
                                q = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                                nx = ranges.MapX0 + p * dx;
                                ny = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                                nz = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                                nw = ranges.MapZ0 + r * dz;
                                val = module.Get(nx, ny, nz, nw);
                                break;
                            case MappingMode.SeamlessZ:
                                dx = ranges.MapX1 - ranges.MapX0;
                                dy = ranges.MapY1 - ranges.MapY0;
                                dz = ranges.LoopZ1 - ranges.LoopZ0;
                                r = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                                nx = ranges.MapX0 + p * dx;
                                ny = ranges.MapY0 + q * dy;
                                nz = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                                nw = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                                val = module.Get(nx, ny, nz, nw);
                                break;
                            case MappingMode.SeamlessXY:
                                dx = ranges.LoopX1 - ranges.LoopX0;
                                dy = ranges.LoopY1 - ranges.LoopY0;
                                dz = ranges.MapZ1 - ranges.MapZ0;
                                p = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                                q = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                                nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                                ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                                nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                                nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                                nu = ranges.MapZ0 + r * dz;
                                val = module.Get(nx, ny, nz, nw, nu, 0);
                                break;
                            case MappingMode.SeamlessXZ:
                                dx = ranges.LoopX1 - ranges.LoopX0;
                                dy = ranges.MapY1 - ranges.MapY0;
                                dz = ranges.LoopZ1 - ranges.LoopZ0;
                                p = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                                r = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                                nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                                ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                                nz = ranges.MapY0 + q * dy;
                                nw = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                                nu = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                                val = module.Get(nx, ny, nz, nw, nu, 0);
                                break;
                            case MappingMode.SeamlessYZ:
                                dx = ranges.MapX1 - ranges.MapX0;
                                dy = ranges.LoopY1 - ranges.LoopY0;
                                dz = ranges.LoopZ1 - ranges.LoopZ0;
                                q = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                                r = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                                nx = ranges.MapX0 + p * dx;
                                ny = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                                nz = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                                nw = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                                nu = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                                val = module.Get(nx, ny, nz, nw, nu, 0);
                                break;
                            case MappingMode.SeamlessXYZ:
                                dx = ranges.LoopX1 - ranges.LoopX0;
                                dy = ranges.LoopY1 - ranges.LoopY0;
                                dz = ranges.LoopZ1 - ranges.LoopZ0;
                                p = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                                q = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                                r = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                                nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                                ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                                nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                                nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                                nu = ranges.LoopZ0 + Math.Cos(r * PI2) * dz / PI2;
                                Double nv = ranges.LoopZ0 + Math.Sin(r * PI2) * dz / PI2;
                                val = module.Get(nx, ny, nz, nw, nu, nv);
                                break;
                        }
                        array[x, y, z] = val;
                    }
                }
            }
        }
예제 #32
0
        public static void Map2DNoZ(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges)
        {
            var width = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var p = x / (double)width;
                    var q = y / (double)height;
                    double nx;
                    double ny;
                    double nz;
                    double dx;
                    double dy;
                    var val = 0.00;
                    switch (mappingMode)
                    {
                        case MappingMode.SeamlessNone:
                            nx = ranges.MapX0 + p*(ranges.MapX1 - ranges.MapX0);
                            ny = ranges.MapY0 + q*(ranges.MapY1 - ranges.MapY0);
                            val = module.Get(nx, ny);
                            break;
                        case MappingMode.SeamlessX:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.MapY0 + q*dy;
                            val = module.Get(nx, ny, nz);
                            break;
                        case MappingMode.SeamlessY:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nz = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            val = module.Get(nx, ny, nz);
                            break;

                        case MappingMode.SeamlessXY:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            double nw = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                    }
                    array[x, y] = val;
                }
            }
        }
예제 #33
0
 /// <summary>
 /// Maps an object of type object to given anonymous
 /// </summary>
 /// <param name="destinationType"></param>
 /// <param name="sourceObj"></param>
 /// <param name="destinationObj"></param>
 /// <param name="mapingMode"></param>
 /// <returns></returns>
 public static object Map(Type destinationType, object sourceObj, object destinationObj = null, MappingMode mapingMode = MappingMode.Map)
 {
     return(MapBuilder.RecursiveMap(destinationType, sourceObj?.GetType(), sourceObj, destinationObj, mapingMode));
 }
예제 #34
0
        public static void Map2D(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges, Double z)
        {
            var width  = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var    p = x / (Double)width;
                    var    q = y / (Double)height;
                    Double r;
                    Double nx;
                    Double ny;
                    Double nz;
                    Double nw;
                    Double nu;
                    Double dx;
                    Double dy;
                    Double dz;
                    var    val = 0.00;
                    switch (mappingMode)
                    {
                    case MappingMode.SeamlessNone:
                        nx  = ranges.MapX0 + p * (ranges.MapX1 - ranges.MapX0);
                        ny  = ranges.MapY0 + q * (ranges.MapY1 - ranges.MapY0);
                        nz  = z;
                        val = module.Get(nx, ny, nz);
                        break;

                    case MappingMode.SeamlessX:
                        dx  = ranges.LoopX1 - ranges.LoopX0;
                        dy  = ranges.MapY1 - ranges.MapY0;
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.MapY0 + q * dy;
                        nw  = z;
                        val = module.Get(nx, ny, nz, nw);
                        break;

                    case MappingMode.SeamlessY:
                        dx  = ranges.MapX1 - ranges.MapX0;
                        dy  = ranges.LoopY1 - ranges.LoopY0;
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.MapX0 + p * dx;
                        ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nw  = z;
                        val = module.Get(nx, ny, nz, nw);
                        break;

                    case MappingMode.SeamlessZ:
                        dx = ranges.MapX1 - ranges.MapX0;
                        dy = ranges.MapY1 - ranges.MapY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        nx = ranges.MapX0 + p * dx;
                        ny = ranges.MapY0 + p * dy;
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var zval = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        nz  = ranges.LoopZ0 + Math.Cos(zval * PI2) * dz / PI2;
                        nw  = ranges.LoopZ0 + Math.Sin(zval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw);
                        break;

                    case MappingMode.SeamlessXY:
                        dx  = ranges.LoopX1 - ranges.LoopX0;
                        dy  = ranges.LoopY1 - ranges.LoopY0;
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nw  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nu  = z;
                        val = module.Get(nx, ny, nz, nw, nu, 0);
                        break;

                    case MappingMode.SeamlessXZ:
                        dx = ranges.LoopX1 - ranges.LoopX0;
                        dy = ranges.MapY1 - ranges.MapY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var xzval = r * (ranges.MapX1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.MapY0 + q * dy;
                        nw  = ranges.LoopZ0 + Math.Cos(xzval * PI2) * dz / PI2;
                        nu  = ranges.LoopZ0 + Math.Sin(xzval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw, nu, 0);
                        break;

                    case MappingMode.SeamlessYZ:
                        dx = ranges.MapX1 - ranges.MapX0;
                        dy = ranges.LoopY1 - ranges.LoopY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var yzval = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.MapX0 + p * dx;
                        ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nw  = ranges.LoopZ0 + Math.Cos(yzval * PI2) * dz / PI2;
                        nu  = ranges.LoopZ0 + Math.Sin(yzval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw, nu, 0);
                        break;

                    case MappingMode.SeamlessXYZ:
                        dx = ranges.LoopX1 - ranges.LoopX0;
                        dy = ranges.LoopY1 - ranges.LoopY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        p  = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        q  = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var xyzval = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nu = ranges.LoopZ0 + Math.Cos(xyzval * PI2) * dz / PI2;
                        double nv = ranges.LoopZ0 + Math.Sin(xyzval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw, nu, nv);
                        break;
                    }
                    array[x, y] = val;
                }
            }
        }
예제 #35
0
        public static void Map2D(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges, Double z)
        {
            var width = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var p = x / (double)width;
                    var q = y / (double)height;
                    double r;
                    double nx;
                    double ny;
                    double nz;
                    double nw;
                    double nu;
                    double dx;
                    double dy;
                    double dz;
                    var val = 0.00;
                    switch (mappingMode)
                    {
                        case MappingMode.SeamlessNone:
                            nx = ranges.MapX0 + p*(ranges.MapX1 - ranges.MapX0);
                            ny = ranges.MapY0 + q*(ranges.MapY1 - ranges.MapY0);
                            nz = z;
                            val = module.Get(nx, ny, nz);
                            break;
                        case MappingMode.SeamlessX:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.MapY0 + q*dy;
                            nw = z;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                        case MappingMode.SeamlessY:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nz = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nw = z;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                        case MappingMode.SeamlessZ:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.MapY0 + p*dy;
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var zval = r*(ranges.MapZ1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            nz = ranges.LoopZ0 + Math.Cos(zval*PI2)*dz/PI2;
                            nw = ranges.LoopZ0 + Math.Sin(zval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                        case MappingMode.SeamlessXY:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nw = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nu = z;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;
                        case MappingMode.SeamlessXZ:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var xzval = r*(ranges.MapX1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.MapY0 + q*dy;
                            nw = ranges.LoopZ0 + Math.Cos(xzval*PI2)*dz/PI2;
                            nu = ranges.LoopZ0 + Math.Sin(xzval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;
                        case MappingMode.SeamlessYZ:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var yzval = r*(ranges.MapZ1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nz = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nw = ranges.LoopZ0 + Math.Cos(yzval*PI2)*dz/PI2;
                            nu = ranges.LoopZ0 + Math.Sin(yzval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;
                        case MappingMode.SeamlessXYZ:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var xyzval = r*(ranges.MapZ1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nw = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nu = ranges.LoopZ0 + Math.Cos(xyzval*PI2)*dz/PI2;
                            double nv = ranges.LoopZ0 + Math.Sin(xyzval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw, nu, nv);
                            break;
                    }
                    array[x, y] = val;
                }
            }
        }