马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- [LispFunction("Vector_Normal")]
- public Object VectorNormal(ResultBuffer rb)
- {
- Object ret = null;
- TypedValue[] values = rb.AsArray();
- if (rb != null)
- {
- if (values.Count() == 1 && values[0].TypeCode == (int) LispDataType.Point3d)
- {
- Point3d point3D = (Point3d) values[0].Value ;
- Vector3d vec = point3D.GetAsVector();
- Vector3d nvec = vec.GetNormal();
- Point3d pt = new Point3d(nvec.X, nvec.Y, nvec.Z);
- ret = pt;
- }
- else
- {
- return null;
- }
- }
- return ret;
- }
- [LispFunction("Vector_CrossProduct")]
- public Object VectorCrossProduct(ResultBuffer rb)
- {
- TypedValue[] values = rb.AsArray();
- Object ret = null;
- if (values.Count() == 2 && values[0].TypeCode == (int)LispDataType.Point3d &&
- values[1].TypeCode == (int)LispDataType.Point3d)
- {
- Point3d p1 = (Point3d)values[0].Value;
- Point3d p2 = (Point3d)values[1].Value;
- Vector3d v1 = p1.GetAsVector().GetNormal();
- Vector3d v2 = p2.GetAsVector().GetNormal();
- Vector3d v =v1.CrossProduct( v2);
- Point3d p = new Point3d(v.X ,v.Y ,v.Z );
- ret = p;
- }
- return ret;
- }
|