示例#1
0
文件: LDSize.cs 项目: johndpope/math
        public void scale(LDSize s, AspectRatioMode mode)
        {
            LDSize size = this.scaled(s, mode);

            this.wd = size.wd;
            this.ht = size.ht;
        }
示例#2
0
文件: LDSize.cs 项目: johndpope/math
        public LDSize scaled(LDSize s, AspectRatioMode mode)
        {
            if (s.isEmpty())
            {
                return(new LDSize());
            }
            LDSize S;

            switch (mode)
            {
            case AspectRatioMode.IgnoreAspectRatio:
                S = s;
                break;

            case AspectRatioMode.KeepAspectRatio:
                S = new LDSize(this.wd * Math.Min(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Min(s.wd / this.wd, s.ht / this.ht));
                break;

            case AspectRatioMode.KeepAspectRatioByExpanding:
                S = new LDSize(this.wd * Math.Max(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Max(s.wd / this.wd, s.ht / this.ht));
                break;

            default:
                S = null;
                break;
            }
            return(S);
        }
示例#3
0
 public LDRect(LDPoint topleft, LDSize size)
 {
     this.xp = topleft.x();
     this.yp = topleft.y();
     this.w  = size.width();
     this.h  = size.height();
 }
示例#4
0
文件: LDRect.cs 项目: KajitaLD/math
 public LDRect(LDPoint topleft, LDSize size)
 {
     this.xp = topleft.x();
     this.yp = topleft.y();
     this.w = size.width();
     this.h = size.height();
 }
示例#5
0
        public void updateUvMap(LDSize ImageSize)
        {
            m_uvMap.Clear();
            for (int i = 0; i < m_points.size(); i++)
            {
                float u = m_points[i].x() / ImageSize.width();
                float v = m_points[i].y() / ImageSize.height();

                LDMathUtil.clamp(u, 0.0f, 1.0f);
                LDMathUtil.clamp(v, 0.0f, 1.0f);

                m_uvMap.Add(new LDPoint(u, v));
            }
        }
示例#6
0
文件: LDSize.cs 项目: johndpope/math
 public LDSize(LDSize sz)
 {
     this.wd = sz.wd;
     this.ht = sz.ht;
 }
示例#7
0
文件: LDSize.cs 项目: johndpope/math
 public LDSize boundedTo(LDSize s)
 {
     return(new LDSize(Math.Min(this.wd, s.wd), Math.Min(this.wd, this.ht)));
 }
示例#8
0
文件: LDSize.cs 项目: johndpope/math
 public LDSize expandedTo(LDSize s)
 {
     return(new LDSize(Math.Max(this.wd, s.wd), Math.Max(this.wd, this.ht)));
 }
示例#9
0
 public void setSize(LDSize s)
 {
     this.w = s.width();
     this.h = s.height();
 }
示例#10
0
文件: LDRect.cs 项目: KajitaLD/math
 public void setSize(LDSize s)
 {
     this.w = s.width();
     this.h = s.height();
 }
示例#11
0
文件: LDSize.cs 项目: KajitaLD/math
 public LDSize expandedTo(LDSize s)
 {
     return new LDSize(Math.Max(this.wd, s.wd), Math.Max(this.wd, this.ht));
 }
示例#12
0
文件: LDSize.cs 项目: KajitaLD/math
 public LDSize boundedTo(LDSize s)
 {
     return new LDSize(Math.Min(this.wd, s.wd), Math.Min(this.wd, this.ht));
 }
示例#13
0
文件: LDSize.cs 项目: KajitaLD/math
 public LDSize(LDSize sz)
 {
     this.wd = sz.wd;
     this.ht = sz.ht;
 }
示例#14
0
文件: LDSize.cs 项目: KajitaLD/math
 public LDSize scaled(LDSize s, AspectRatioMode mode)
 {
     if (s.isEmpty()) return new LDSize();
     LDSize S;
     switch (mode)
     {
         case AspectRatioMode.IgnoreAspectRatio:
             S = s;
             break;
         case AspectRatioMode.KeepAspectRatio:
             S = new LDSize(this.wd * Math.Min(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Min(s.wd / this.wd, s.ht / this.ht));
             break;
         case AspectRatioMode.KeepAspectRatioByExpanding:
             S = new LDSize(this.wd * Math.Max(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Max(s.wd / this.wd, s.ht / this.ht));
             break;
         default:
             S = null;
             break;
     }
     return S;
 }
示例#15
0
文件: LDSize.cs 项目: KajitaLD/math
 public void scale(LDSize s, AspectRatioMode mode)
 {
     LDSize size = this.scaled(s, mode);
     this.wd = size.wd;
     this.ht = size.ht;
 }
示例#16
0
文件: LDUvMesh.cs 项目: KajitaLD/math
        public void updateUvMap(LDSize ImageSize)
        {
            m_uvMap.Clear();
            for (int i = 0; i < m_points.size(); i++)
            {
                float u = m_points[i].x() / ImageSize.width();
                float v = m_points[i].y() / ImageSize.height();

                LDMathUtil.clamp(u, 0.0f, 1.0f);
                LDMathUtil.clamp(v, 0.0f, 1.0f);

                m_uvMap.Add(new LDPoint(u, v));
            }
        }