Eval() публичный Метод

public Eval ( float x, float y, float z ) : float
x float
y float
z float
Результат float
Пример #1
0
        protected void Generate()
        {
            var   julia  = new Julia(this.globalReal, this.globalImag, this.globalTheta);
            float scale  = 2.5f;
            float vcut   = 29.0f;
            float vscale = 1.0f / vcut;

            HardwarePixelBuffer buffer = this.ptex.GetBuffer(0, 0);

            LogManager.Instance.Write("Volume Texture Sample [info]: HardwarePixelBuffer " + buffer.Width + "x" + buffer.Height);

            buffer.Lock(BufferLocking.Normal);
            PixelBox pb = buffer.CurrentLock;

            LogManager.Instance.Write("Volume Texture Sample [info]: PixelBox " + pb.Width + "x" + pb.Height + "x" + pb.Depth);

            unsafe
            {
                var pbptr = (BufferBase)pb.Data.Clone();
                for (int z = pb.Front; z < pb.Back; z++)
                {
                    for (int y = pb.Top; y < pb.Bottom; y++)
                    {
                        pbptr += pb.Left * sizeof(uint);
                        for (int x = pb.Left; x < pb.Right; x++)
                        {
                            if (z == pb.Front || z == (pb.Back - 1) || y == pb.Top || y == (pb.Bottom - 1) || x == pb.Left ||
                                x == (pb.Right - 1))
                            {
                                pbptr.ToUIntPointer()[0] = 0;
                            }
                            else
                            {
                                float val = julia.Eval(((float)x / pb.Width - 0.5f) * scale, ((float)y / pb.Height - 0.5f) * scale,
                                                       ((float)z / pb.Depth - 0.5f) * scale);
                                if (val > vcut)
                                {
                                    val = vcut;
                                }

                                PixelConverter.PackColor((float)x / pb.Width, (float)y / pb.Height, (float)z / pb.Depth,
                                                         (1.0f - (val * vscale)) * 0.7f, PixelFormat.A8R8G8B8, pbptr);
                            }
                            pbptr++;
                        }
                        pbptr += (pb.RowPitch - pb.Right) * sizeof(uint);
                    }
                    pbptr += pb.SliceSkip * sizeof(uint);
                }
                buffer.Unlock();
            }
        }
Пример #2
0
		protected void Generate()
		{
			var julia = new Julia( this.globalReal, this.globalImag, this.globalTheta );
			float scale = 2.5f;
			float vcut = 29.0f;
			float vscale = 1.0f/vcut;

			HardwarePixelBuffer buffer = this.ptex.GetBuffer( 0, 0 );

			LogManager.Instance.Write( "Volume Texture Sample [info]: HardwarePixelBuffer " + buffer.Width + "x" + buffer.Height );

			buffer.Lock( BufferLocking.Normal );
			PixelBox pb = buffer.CurrentLock;

			LogManager.Instance.Write( "Volume Texture Sample [info]: PixelBox " + pb.Width + "x" + pb.Height + "x" + pb.Depth );

			unsafe
			{
				var pbptr = (BufferBase)pb.Data.Clone();
				for ( int z = pb.Front; z < pb.Back; z++ )
				{
					for ( int y = pb.Top; y < pb.Bottom; y++ )
					{
						pbptr += pb.Left*sizeof ( uint );
						for ( int x = pb.Left; x < pb.Right; x++ )
						{
							if ( z == pb.Front || z == ( pb.Back - 1 ) || y == pb.Top || y == ( pb.Bottom - 1 ) || x == pb.Left ||
							     x == ( pb.Right - 1 ) )
							{
								pbptr.ToUIntPointer()[ 0 ] = 0;
							}
							else
							{
								float val = julia.Eval( ( (float)x/pb.Width - 0.5f )*scale, ( (float)y/pb.Height - 0.5f )*scale,
								                        ( (float)z/pb.Depth - 0.5f )*scale );
								if ( val > vcut )
								{
									val = vcut;
								}

								PixelConverter.PackColor( (float)x/pb.Width, (float)y/pb.Height, (float)z/pb.Depth,
								                          ( 1.0f - ( val*vscale ) )*0.7f, PixelFormat.A8R8G8B8, pbptr );
							}
							pbptr++;
						}
						pbptr += ( pb.RowPitch - pb.Right )*sizeof ( uint );
					}
					pbptr += pb.SliceSkip*sizeof ( uint );
				}
				buffer.Unlock();
			}
		}