Skip to content

Instantly share code, notes, and snippets.

//++ 合并两个pb结构++//
public static void mergeFromPb(object oldObj, object newObj, List<string> ignore_list = null){
if(oldObj.Equals(newObj))
return;
Type oldType = oldObj.GetType();
Type newType = newObj.GetType();
// if(oldType.Equals(newType) == false){
// return;
// }
PropertyInfo[] newInfos = newType.GetProperties();
@tiantian20007
tiantian20007 / gist:2234560
Created March 29, 2012 07:32
Get distance between two point
import math
def distance(point1,point2):
"""get distance between 2 point, point: sequence=>x,y
"""
dis = math.sqrt(math.pow(point1[0]-point2[0],2)+math.pow(point1[1]-point2[1],2))
return dis