• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LSL_Types.Quaternion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion的典型用法代码示例。如果您正苦于以下问题:C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion类的具体用法?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion怎么用?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion类属于命名空间,在下文中一共展示了Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: llSetVehicleRotationParam

        //CFK 9/28: Most, but not all of the underlying plumbing between here and the physics modules is in
        //CFK 9/28: so these are not complete yet.
        public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
        {
            if(!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            if (m_host.ParentEntity != null)
            {
                if (!m_host.ParentEntity.IsDeleted)
                {
                    m_host.ParentEntity.RootChild.SetVehicleRotationParam (param,
                        Rot2Quaternion(rot));
                }
            }
        }
开发者ID:kchi059,项目名称:Aurora-Sim,代码行数:15,代码来源:LSL_Api.cs


示例2: llSitTarget

        public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            
            // LSL quaternions can normalize to 0, normal Quaternions can't.
            if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
                rot.z = 1; // ZERO_ROTATION = 0,0,0,1

            m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
            m_host.SitTargetOrientation = Rot2Quaternion(rot);
            m_host.ParentGroup.HasGroupChanged = true;
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:12,代码来源:LSL_Api.cs


示例3: Rot2Quaternion

 // convert a LSL_Rotation to a Quaternion
 protected Quaternion Rot2Quaternion(LSL_Rotation r)
 {
     Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
     q.Normalize();
     return q;
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:7,代码来源:LSL_Api.cs


示例4: llLinkSitTarget

        public void llLinkSitTarget (LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
        {
            if(!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            // LSL quaternions can normalize to 0, normal Quaternions can't.
            if(rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
                rot.z = 1; // ZERO_ROTATION = 0,0,0,1

            List<ISceneChildEntity> entities = GetLinkParts(link);
            if(entities.Count == 0)
                return;

            entities[0].SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
            entities[0].SitTargetOrientation = Rot2Quaternion(rot);
        }
开发者ID:kchi059,项目名称:Aurora-Sim,代码行数:15,代码来源:LSL_Api.cs


示例5: llSetLocalRot

        public DateTime llSetLocalRot(LSL_Rotation rot)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");

            SetRot(m_host, Rot2Quaternion(rot));
            return PScriptSleep(200);
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:7,代码来源:LSL_Api.cs


示例6: llRotTarget

 public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
 {
     ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
     
     return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error);
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:6,代码来源:LSL_Api.cs


示例7: llRotLookAt

        public void llRotLookAt(LSL_Rotation target, double strength, double damping)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");

            Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s);
            m_host.RotLookAt(rot, (float)strength, (float)damping);
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:7,代码来源:LSL_Api.cs


示例8: llSetVehicleRotationParam

 //CFK 9/28: Most, but not all of the underlying plumbing between here and the physics modules is in
 //CFK 9/28: so these are not complete yet.
 public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
 {
     ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
     
     if (m_host.ParentGroup != null)
     {
         if (!m_host.ParentGroup.IsDeleted)
         {
             m_host.ParentGroup.RootPart.SetVehicleRotationParam(param,
                 Rot2Quaternion(rot));
         }
     }
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:15,代码来源:LSL_Api.cs


示例9: llRot2Up

        public LSL_Vector llRot2Up(LSL_Rotation r)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            
            double x, y, z, m;

            m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;
            // m is always greater than zero
            // if m is not equal to 1 then Rotation needs to be normalized
            if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision
            {
                m = 1.0 / Math.Sqrt(m);
                r.x *= m;
                r.y *= m;
                r.z *= m;
                r.s *= m;
            }

            // Fast Algebric Calculations instead of Vectors & Quaternions Product
            x = 2 * (r.x * r.z + r.y * r.s);
            y = 2 * (-r.x * r.s + r.y * r.z);
            z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s;
            return (new LSL_Vector(x, y, z));
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:24,代码来源:LSL_Api.cs


示例10: llSetRot

        public DateTime llSetRot(LSL_Rotation rot)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            

            // try to let this work as in SL...
            if (m_host.ParentID == 0)
            {
                // special case: If we are root, rotate complete SOG to new rotation
                SetRot(m_host, Rot2Quaternion(rot));
            }
            else
            {
                // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
                SceneObjectGroup group = m_host.ParentGroup;
                if (group != null) // a bit paranoid, maybe
                {
                    SceneObjectPart rootPart = group.RootPart;
                    if (rootPart != null) // again, better safe than sorry
                    {
                        SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
                    }
                }
            }
            return PScriptSleep(200);
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:26,代码来源:LSL_Api.cs


示例11: llRotBetween

 public LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
 {
     ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
     //A and B should both be normalized
     
     LSL_Rotation rotBetween;
     // Check for zero vectors. If either is zero, return zero rotation. Otherwise,
     // continue calculation.
     if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
     {
         rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
     }
     else
     {
         a = LSL_Vector.Norm(a);
         b = LSL_Vector.Norm(b);
         double dotProduct = LSL_Vector.Dot(a, b);
         // There are two degenerate cases possible. These are for vectors 180 or
         // 0 degrees apart. These have to be detected and handled individually.
         //
         // Check for vectors 180 degrees apart.
         // A dot product of -1 would mean the angle between vectors is 180 degrees.
         if (dotProduct < -0.9999999f)
         {
             // First assume X axis is orthogonal to the vectors.
             LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
             orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a));
             // Check for near zero vector. A very small non-zero number here will create
             // a rotation in an undesired direction.
             if (LSL_Vector.Mag(orthoVector) > 0.0001)
             {
                 rotBetween = new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f);
             }
             // If the magnitude of the vector was near zero, then assume the X axis is not
             // orthogonal and use the Z axis instead.
             else
             {
                 // Set 180 z rotation.
                 rotBetween = new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
             }
         }
         // Check for parallel vectors.
         // A dot product of 1 would mean the angle between vectors is 0 degrees.
         else if (dotProduct > 0.9999999f)
         {
             // Set zero rotation.
             rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
         }
         else
         {
             // All special checks have been performed so get the axis of rotation.
             LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
             // Quarternion s value is the length of the unit vector + dot product.
             double qs = 1.0 + dotProduct;
             rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
             // Normalize the rotation.
             double mag = LSL_Rotation.Mag(rotBetween);
             // We shouldn't have to worry about a divide by zero here. The qs value will be
             // non-zero because we already know if we're here, then the dotProduct is not -1 so
             // qs will not be zero. Also, we've already handled the input vectors being zero so the
             // crossProduct vector should also not be zero.
             rotBetween.x = rotBetween.x / mag;
             rotBetween.y = rotBetween.y / mag;
             rotBetween.z = rotBetween.z / mag;
             rotBetween.s = rotBetween.s / mag;
             // Check for undefined values and set zero rotation if any found. This code might not actually be required
             // any longer since zero vectors are checked for at the top.
             if (Double.IsNaN(rotBetween.x) || Double.IsNaN(rotBetween.y) || Double.IsNaN(rotBetween.z) || Double.IsNaN(rotBetween.s))
             {
                 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
             }
         }
     }
     return rotBetween;
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:75,代码来源:LSL_Api.cs


示例12:

        // Returns the angle of a quaternion (see llRot2Axis for the axis)
        public LSL_Float llRot2Angle(LSL_Rotation rot)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            

            if (rot.s > 1) // normalization needed
            {
                double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
                        rot.z * rot.z + rot.s * rot.s);

                if (length == 0)
                    return 0;
//                rot.x /= length;
//                rot.y /= length;
//                rot.z /= length;
                rot.s /= length;
            }

            double angle = 2 * Math.Acos(rot.s);

            return angle;
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:23,代码来源:LSL_Api.cs


示例13: LSL_Vector

        //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke

        // Old implementation of llRot2Euler. Normalization not required as Atan2 function will
        // only return values >= -PI (-180 degrees) and <= PI (180 degrees).

        public LSL_Vector llRot2Euler(LSL_Rotation r)
        {
            //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
            LSL_Rotation t = new LSL_Rotation(r.x * r.x, r.y * r.y, r.z * r.z, r.s * r.s);
            double m = (t.x + t.y + t.z + t.s);
            if (m == 0) return new LSL_Vector();
            double n = 2 * (r.y * r.s + r.x * r.z);
            double p = m * m - n * n;
            if (p > 0)
                return new LSL_Vector(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s)),
                                             Math.Atan2(n, Math.Sqrt(p)),
                                             Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)));
            else if (n > 0)
                return new LSL_Vector(0.0, Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
            else
                return new LSL_Vector(0.0, -Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:22,代码来源:LSL_Api.cs


示例14: llRezObject

 public DateTime llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
 {
     return llRezPrim(inventory, pos, vel, rot, param, false, true, true, true);
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:4,代码来源:LSL_Api.cs


示例15:

 public LSL_Vector llRot2Up(LSL_Rotation r)
 {
     return m_LSL_Functions.llRot2Up(r);
 }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:LSL_Stub.cs


示例16: llRotLookAt

 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
 {
     m_LSL_Functions.llRotLookAt(target, strength, damping);
 }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:LSL_Stub.cs


示例17: llRezObject

 public DateTime llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
 {
     return m_LSL_Functions.llRezObject(inventory, pos, vel, rot, param);
 }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:LSL_Stub.cs


示例18: llRezAtRoot

 public DateTime llRezAtRoot(string inventory, LSL_Vector position, LSL_Vector velocity, LSL_Rotation rot, int param)
 {
     return m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param);
 }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:LSL_Stub.cs


示例19: llRotTarget

 public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
 {
     return m_LSL_Functions.llRotTarget(rot, error);
 }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:LSL_Stub.cs


示例20: llSetRot

 public DateTime llSetRot(LSL_Rotation rot)
 {
     return m_LSL_Functions.llSetRot(rot);
 }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:LSL_Stub.cs



注:本文中的Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LSL_Types.Vector3类代码示例发布时间:2022-05-24
下一篇:
C# LSL_Types.LSLString类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap