你的CPP=我的CPP

唾沫是用来数钞票滴,不是用来讲道理的

2008年7月4日 #

Lua学习之--util.lua

-- util.lua
-- Common Lua Function
-- Author: Liu Denghong
-- Date: 20080702

require "liu"

liu.util = liu.util or {version = 0.1;};
liu.util.Print=function(msg)
  print(msg);
end;

-- Min
liu.util.Min = function(a,b)
  return (a<b and a) or b;
end;

-- Max
liu.util.Max = function(a,b)
  return (a>b and a) or b;
end;


-- IsTrue
liu.util.IsTrue = function(a)
  return (a~=false and a~=nil);
end;


-- 只适用于表: a={"liu","deng","hong"};
-- 不适用于记录型表: b={name="liu", name1="deng", name2="hong"}
-- 等价于ipairs(t)
liu.util.TableIter = function(t)
  local i = 0
  local n = table.getn(t)

  return function ()
    i = i + 1
    if i <= n then return t[i] end
  end
end

 

posted @ 2008-07-04 15:32 晨风 阅读(879) | 评论 (0)编辑 收藏

2008年7月2日 #

lua学习之--liu.lua

-- liu.lua
-- Common Lua Function
-- Author: Liu Denghong
-- Date: 20080630

liu = liu or {version='0.1';};

-- Examp: liu.Apply(liu, {a=1,b=2});
liu.Apply = function(o, c, defaults)
  if defaults then
    liu.Apply(o, defaults);
  end
  if (o and c and type(c)=="table") then
    for p,v in pairs(c) do
      o[p] = v;
    end
  end
end

liu.Apply(liu, {
  EmptyFn = function() end;

  Num = function(v, defaultValue)
    if(type(v) ~= "number") then
      return defaultValue;
    end
    return v;
  end;

});

 

posted @ 2008-07-02 11:03 晨风 阅读(371) | 评论 (2)编辑 收藏

2008年1月4日 #

图像旋转公式


   图像旋转是指把定义的图像绕某一点以逆时针或顺时针方向旋转一定的角度,通常是指绕图像的中心以逆时针方向旋转。

   假设图像的左上角为(left, top),右下角为(right, bottom),则图像上任意点(x0, y0)绕其中心(xcenter, ycenter)逆时针旋转angle角度后,新的坐标位置(x′, y′)的计算公式为:

xcenter = (right - left + 1) / 2 + left;
ycenter = (bottom - top + 1) / 2 + top;
x′ = (x0 - xcenter) cosθ - (y0 - ycenter) sinθ + xcenter;
y′ = (x0 - xcenter) sinθ + (y0 - ycenter) cosθ + ycenter;

   与图像的镜像变换相类似,也采用按行逐点变换的方式实现图像的旋转

(摘录自http://v3.7880.com/Info/Article-79ea53c0.html
hhh

posted @ 2008-01-04 18:04 晨风 阅读(5463) | 评论 (1)编辑 收藏

2007年12月25日 #

用c++处理XML文件

今天要用c++处理一个XML文件,但是又不想用很庞大的库。

最后在网上找到了一个小巧的类CMarkup. 感觉非常好用。

http://www.firstobject.com/dn_markup.htm

posted @ 2007-12-25 14:46 晨风 阅读(478) | 评论 (0)编辑 收藏

2007年12月22日 #

物品分类的设计

     摘要: 物件分类的管理C++  阅读全文

posted @ 2007-12-22 15:34 晨风 阅读(430) | 评论 (0)编辑 收藏

庆祝我的C++博客开通

     摘要: 庆祝我的C++博客开通  阅读全文

posted @ 2007-12-22 15:19 晨风 阅读(306) | 评论 (4)编辑 收藏

仅列出标题  

My Links

Blog Stats

常用链接

留言簿(1)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜