统一加速

2024-01-27

我正在尝试在 Unity 中模拟加速和减速。

我编写了代码来在 Unity 中生成轨道,并根据时间将对象放置在轨道上的特定位置。结果看起来有点像这样。

我目前遇到的问题是样条线的每个部分都有不同的长度,并且立方体以不同但均匀的速度穿过每个部分。这会导致在部分之间转换时立方体的速度变化突然跳跃。

为了尝试解决这个问题,我尝试使用罗伯特·彭纳 (Robert Penner) 的缓动方程 https://gist.github.com/xanathar/735e17ac129a72a277ee on the GetTime(Vector3 p0, Vector3 p1, float alpha)方法。然而,虽然这确实有所帮助,但还不够。在转换之间仍然存在速度跳跃。

有谁知道如何动态地缓和立方体的位置,使其看起来像是在加速和减速,而轨道各段之间的速度不会大幅跳跃?


我编写了一个脚本,显示了我的代码的简单实现。它可以附加到任何游戏对象。为了便于查看代码运行时发生的情况,请附加到立方体或球体等物体。

using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class InterpolationExample : MonoBehaviour {
    [Header("Time")]
    [SerializeField]
    private float currentTime;
    private float lastTime = 0;
    [SerializeField]
    private float timeModifier = 1;
    [SerializeField]
    private bool running = true;
    private bool runningBuffer = true;

    [Header("Track Settings")]
    [SerializeField]
    [Range(0, 1)]
    private float catmullRomAlpha = 0.5f;
    [SerializeField]
    private List<SimpleWayPoint> wayPoints = new List<SimpleWayPoint>
    {
        new SimpleWayPoint() {pos = new Vector3(-4.07f, 0, 6.5f), time = 0},
        new SimpleWayPoint() {pos = new Vector3(-2.13f, 3.18f, 6.39f), time = 1},
        new SimpleWayPoint() {pos = new Vector3(-1.14f, 0, 4.55f), time = 6},
        new SimpleWayPoint() {pos = new Vector3(0.07f, -1.45f, 6.5f), time = 7},
        new SimpleWayPoint() {pos = new Vector3(1.55f, 0, 3.86f), time = 7.2f},
        new SimpleWayPoint() {pos = new Vector3(4.94f, 2.03f, 6.5f), time = 10}
    };

    [Header("Debug")]
    [Header("WayPoints")]
    [SerializeField]
    private bool debugWayPoints = true;
    [SerializeField]
    private WayPointDebugType debugWayPointType = WayPointDebugType.SOLID;
    [SerializeField]
    private float debugWayPointSize = 0.2f;
    [SerializeField]
    private Color debugWayPointColour = Color.green;
    [Header("Track")]
    [SerializeField]
    private bool debugTrack = true;
    [SerializeField]
    [Range(0, 1)]
    private float debugTrackResolution = 0.04f;
    [SerializeField]
    private Color debugTrackColour = Color.red;

    [System.Serializable]
    private class SimpleWayPoint
    {
        public Vector3 pos;
        public float time;
    }

    [System.Serializable]
    private enum WayPointDebugType
    {
        SOLID,
        WIRE
    }

    private void Start()
    {
        wayPoints.Sort((x, y) => x.time.CompareTo(y.time));
        wayPoints.Insert(0, wayPoints[0]);
        wayPoints.Add(wayPoints[wayPoints.Count - 1]);
    }

    private void LateUpdate()
    {
        //This means that if currentTime is paused, then resumed, there is not a big jump in time
        if(runningBuffer != running)
        {
            runningBuffer = running;
            lastTime = Time.time;
        }

        if(running)
        {
            currentTime += (Time.time - lastTime) * timeModifier;
            lastTime = Time.time;
            if(currentTime > wayPoints[wayPoints.Count - 1].time)
            {
                currentTime = 0;
            }
        }
        transform.position = GetPosition(currentTime);
    }

    #region Catmull-Rom Math
    public Vector3 GetPosition(float time)
    {
        //Check if before first waypoint
        if(time <= wayPoints[0].time)
        {
            return wayPoints[0].pos;
        }
        //Check if after last waypoint
        else if(time >= wayPoints[wayPoints.Count - 1].time)
        {
            return wayPoints[wayPoints.Count - 1].pos;
        }

        //Check time boundaries - Find the nearest WayPoint your object has passed
        float minTime = -1;
        float maxTime = -1;
        int minIndex = -1;
        for(int i = 1; i < wayPoints.Count; i++)
        {
            if(time > wayPoints[i - 1].time && time <= wayPoints[i].time)
            {
                maxTime = wayPoints[i].time;
                int index = i - 1;
                minTime = wayPoints[index].time;
                minIndex = index;
            }
        }

        float timeDiff = maxTime - minTime;
        float percentageThroughSegment = 1 - ((maxTime - time) / timeDiff);

        //Define the 4 points required to make a Catmull-Rom spline
        Vector3 p0 = wayPoints[ClampListPos(minIndex - 1)].pos;
        Vector3 p1 = wayPoints[minIndex].pos;
        Vector3 p2 = wayPoints[ClampListPos(minIndex + 1)].pos;
        Vector3 p3 = wayPoints[ClampListPos(minIndex + 2)].pos;

        return GetCatmullRomPosition(percentageThroughSegment, p0, p1, p2, p3, catmullRomAlpha);
    }

    //Prevent Index Out of Array Bounds
    private int ClampListPos(int pos)
    {
        if(pos < 0)
        {
            pos = wayPoints.Count - 1;
        }

        if(pos > wayPoints.Count)
        {
            pos = 1;
        }
        else if(pos > wayPoints.Count - 1)
        {
            pos = 0;
        }

        return pos;
    }

    //Math behind the Catmull-Rom curve. See here for a good explanation of how it works. https://stackoverflow.com/a/23980479/4601149
    private Vector3 GetCatmullRomPosition(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float alpha)
    {
        float dt0 = GetTime(p0, p1, alpha);
        float dt1 = GetTime(p1, p2, alpha);
        float dt2 = GetTime(p2, p3, alpha);

        Vector3 t1 = ((p1 - p0) / dt0) - ((p2 - p0) / (dt0 + dt1)) + ((p2 - p1) / dt1);
        Vector3 t2 = ((p2 - p1) / dt1) - ((p3 - p1) / (dt1 + dt2)) + ((p3 - p2) / dt2);

        t1 *= dt1;
        t2 *= dt1;

        Vector3 c0 = p1;
        Vector3 c1 = t1;
        Vector3 c2 = (3 * p2) - (3 * p1) - (2 * t1) - t2;
        Vector3 c3 = (2 * p1) - (2 * p2) + t1 + t2;
        Vector3 pos = CalculatePosition(t, c0, c1, c2, c3);

        return pos;
    }

    private float GetTime(Vector3 p0, Vector3 p1, float alpha)
    {
        if(p0 == p1)
            return 1;
        return Mathf.Pow((p1 - p0).sqrMagnitude, 0.5f * alpha);
    }

    private Vector3 CalculatePosition(float t, Vector3 c0, Vector3 c1, Vector3 c2, Vector3 c3)
    {
        float t2 = t * t;
        float t3 = t2 * t;
        return c0 + c1 * t + c2 * t2 + c3 * t3;
    }

    //Utility method for drawing the track
    private void DisplayCatmullRomSpline(int pos, float resolution)
    {
        Vector3 p0 = wayPoints[ClampListPos(pos - 1)].pos;
        Vector3 p1 = wayPoints[pos].pos;
        Vector3 p2 = wayPoints[ClampListPos(pos + 1)].pos;
        Vector3 p3 = wayPoints[ClampListPos(pos + 2)].pos;

        Vector3 lastPos = p1;
        int maxLoopCount = Mathf.FloorToInt(1f / resolution);

        for(int i = 1; i <= maxLoopCount; i++)
        {
            float t = i * resolution;
            Vector3 newPos = GetCatmullRomPosition(t, p0, p1, p2, p3, catmullRomAlpha);
            Gizmos.DrawLine(lastPos, newPos);
            lastPos = newPos;
        }
    }
    #endregion

    private void OnDrawGizmos()
    {
        #if UNITY_EDITOR
        if(EditorApplication.isPlaying)
        {
            if(debugWayPoints)
            {
                Gizmos.color = debugWayPointColour;
                foreach(SimpleWayPoint s in wayPoints)
                {
                    if(debugWayPointType == WayPointDebugType.SOLID)
                    {
                        Gizmos.DrawSphere(s.pos, debugWayPointSize);
                    }
                    else if(debugWayPointType == WayPointDebugType.WIRE)
                    {
                        Gizmos.DrawWireSphere(s.pos, debugWayPointSize);
                    }
                }
            }

            if(debugTrack)
            {
                Gizmos.color = debugTrackColour;
                if(wayPoints.Count >= 2)
                {
                    for(int i = 0; i < wayPoints.Count; i++)
                    {
                        if(i == 0 || i == wayPoints.Count - 2 || i == wayPoints.Count - 1)
                        {
                            continue;
                        }

                        DisplayCatmullRomSpline(i, debugTrackResolution);
                    }
                }
            }
        }
        #endif
    }
}

好吧,让我们放一些math关于这一点。

我一直主张数学在游戏开发中的重要性和实用性,也许我在这个答案上讨论得太过分了,但我真的认为你的问题根本不是关于编码的,而是关于建模和解决代数问题的。不管怎样,我们走吧。

参数化

如果你有大学学位,你可能会记得一些关于功能- 接受参数并产生结果的操作 - 以及graphs- 函数与其参数的演变的图形表示(或绘图)。f(x)可能会提醒你一件事:它说一个名为f取决于普拉特x。所以,“为了参数化 https://en.wikipedia.org/wiki/Parametrization“粗略地表示用一个或多个参数来表达一个系统。

您可能不熟悉这些术语,但您一直在这样做。你的Track例如,是一个具有 3 个参数的系统:f(x,y,z).

关于参数化的一个有趣的事情是,您可以获取一个系统并用其他参数来描述它。再说一次,你已经在这样做了。当你描述轨迹随时间的演变时,你是说每个坐标都是时间的函数,f(x,y,z) = f(x(t),y(t),z(t)) = f(t)。换句话说,您可以使用时间来计算每个坐标,并使用这些坐标在给定时间内将对象定位在空间中。

轨道系统建模

最后,我开始回答你的问题。为了完整地描述您想要的 Track 系统,您需要两件事:

  1. A path;

您实际上已经解决了这部分。您在场景空间中设置一些点并使用Catmull–Rom 样条插值点并生成路径。这很聪明,而且没有什么可做的。

另外,您还添加了一个字段time在每个点上,因此您要确保移动对象将在此时通过此检查。我稍后会回来讨论这个问题。

  1. 一个移动的物体。

关于 Path 解决方案的一件有趣的事情是,您使用一个参数化了路径计算percentageThroughSegment参数 - 范围从 0 到 1 的值,表示段内的相对位置。在您的代码中,您以固定的时间步长进行迭代,并且您的percentageThroughSegment将是所花费的时间与该段的总时间跨度之间的比例。由于每个段都有特定的时间跨度,因此您可以模拟许多恒定速度。

这是相当标准的,但有一个微妙之处。您忽略了描述运动的一个非常重要的部分:行驶距离.

我建议你采用不同的方法。使用行驶的距离来参数化您的路径。那么,物体的运动将是相对于时间参数化的行进距离。这样您将拥有两个独立且一致的系统。动手干活!

Example:

从现在开始,为了简单起见,我会将所有内容都设为 2D,但稍后将其更改为 3D 将是微不足道的。

考虑以下路径:

Where i是段的索引,d是行驶的距离,并且x, y是平面上的坐标。这可能是由像您这样的样条曲线创建的路径,或者使用贝塞尔曲线或其他曲线创建的路径。

使用当前解决方案的对象所产生的运动可以描述为以下图表:distance traveled on the path vs time像这样:

Where t表中是物体必须到达检查点的时间,d又是到达该位置的距离,v是速度并且a是加速度。

上部显示了物体如何随时间前进。横轴是时间,纵轴是行驶的距离。我们可以想象垂直轴是一条直线“展开”的路径。下图是速度随时间的演变。

此时我们必须回顾一些物理学,并注意,在每个段,距离图都是一条直线,对应于匀速运动,没有加速度。这样的系统由以下方程描述:d = do + v*t

每当对象到达检查点时,其速度值就会突然发生变化(因为其图形中没有连续性),这会在场景中产生奇怪的效果。是的,您已经知道这一点,这正是您提出这个问题的原因。

好吧,我们怎样才能做得更好呢?嗯...如果速度图是连续的,就不会出现令人讨厌的速度跳跃。对这样的运动最简单的描述可以是均匀加速。这样的系统由以下方程描述:d = do + vo*t + a*t^2/2。我们还必须假设一个初始速度,我将在这里选择零(与静止分开)。

正如我们所期望的,速度图是连续的,运动通过路径加速。可以将其编码到 Unity 中,更改方法Start and GetPosition像这样:

private List<float> lengths = new List<float>();
private List<float> speeds = new List<float>();
private List<float> accels = new List<float>();
public float spdInit = 0;

private void Start()
{
  wayPoints.Sort((x, y) => x.time.CompareTo(y.time));
  wayPoints.Insert(0, wayPoints[0]);
  wayPoints.Add(wayPoints[wayPoints.Count - 1]);
       for (int seg = 1; seg < wayPoints.Count - 2; seg++)
  {
    Vector3 p0 = wayPoints[seg - 1].pos;
    Vector3 p1 = wayPoints[seg].pos;
    Vector3 p2 = wayPoints[seg + 1].pos;
    Vector3 p3 = wayPoints[seg + 2].pos;
    float len = 0.0f;
    Vector3 prevPos = GetCatmullRomPosition(0.0f, p0, p1, p2, p3, catmullRomAlpha);
    for (int i = 1; i <= Mathf.FloorToInt(1f / debugTrackResolution); i++)
    {
      Vector3 pos = GetCatmullRomPosition(i * debugTrackResolution, p0, p1, p2, p3, catmullRomAlpha);
      len += Vector3.Distance(pos, prevPos);
      prevPos = pos;
    }
    float spd0 = seg == 1 ? spdInit : speeds[seg - 2];
    float lapse = wayPoints[seg + 1].time - wayPoints[seg].time;
    float acc = (len - spd0 * lapse) * 2 / lapse / lapse;
    float speed = spd0 + acc * lapse;
    lengths.Add(len);
    speeds.Add(speed);
    accels.Add(acc);
  }
}

public Vector3 GetPosition(float time)
{
  //Check if before first waypoint
  if (time <= wayPoints[0].time)
  {
    return wayPoints[0].pos;
  }
  //Check if after last waypoint
  else if (time >= wayPoints[wayPoints.Count - 1].time)
  {
    return wayPoints[wayPoints.Count - 1].pos;
  }

  //Check time boundaries - Find the nearest WayPoint your object has passed
  float minTime = -1;
  // float maxTime = -1;
  int minIndex = -1;
  for (int i = 1; i < wayPoints.Count; i++)
  {
    if (time > wayPoints[i - 1].time && time <= wayPoints[i].time)
    {
      // maxTime = wayPoints[i].time;
      int index = i - 1;
      minTime = wayPoints[index].time;
      minIndex = index;
    }
  }

  float spd0 = minIndex == 1 ? spdInit : speeds[minIndex - 2];
  float len = lengths[minIndex - 1];
  float acc = accels[minIndex - 1];
  float t = time - minTime;
  float posThroughSegment = spd0 * t + acc * t * t / 2;
  float percentageThroughSegment = posThroughSegment / len;

  //Define the 4 points required to make a Catmull-Rom spline
  Vector3 p0 = wayPoints[ClampListPos(minIndex - 1)].pos;
  Vector3 p1 = wayPoints[minIndex].pos;
  Vector3 p2 = wayPoints[ClampListPos(minIndex + 1)].pos;
  Vector3 p3 = wayPoints[ClampListPos(minIndex + 2)].pos;

  return GetCatmullRomPosition(percentageThroughSegment, p0, p1, p2, p3, catmullRomAlpha);
}

好吧,让我们看看进展如何……

呃……呃哦。 它看起来几乎不错,只是在某些时候它会向后移动,然后再次前进。实际上,如果我们检查图表,就会发现那里有描述。在 12 到 16 秒之间,速度为负值。为什么会出现这种情况?因为这种运动功能(恒定加速度)虽然简单,但有一些局限性。对于一些突然的速度变化,可能没有一个恒定的加速度值可以保证我们的前提(在正确的时间通过检查点)而不会产生类似的副作用。

我们现在干什么?

你有很多选择:

  • 描述具有线性加速度变化的系统并应用边界条件(警告:lots需要求解的方程组);
  • 描述一个在一段时间内保持恒定加速度的系统,例如在曲线之前/之后加速或减速,然后在路段的其余部分保持恒定速度(警告:方程求解,很难保证在正确的时间通过检查点的前提);
  • 使用插值方法生成随时间变化的位置图。我尝试过 Catmull-Rom 本身,但我不喜欢结果,因为速度看起来不太流畅。贝塞尔曲线似乎是一种更好的方法,因为您可以直接操纵控制点上的斜率(又称速度)并避免向后移动;
  • 我最喜欢的:添加公共AnimationCurve类上的字段并在编辑器中使用超棒的内置抽屉自定义您的运动图表!您可以使用其轻松添加控制点AddKey方法并用其获取一段时间的位置Evaluate方法。 你甚至可以使用OnValidate组件类上的方法可以在您在曲线中编辑场景时自动更新场景中的点,反之亦然。

不要停在那里!在路径的线条 Gizmo 上添加渐变,以轻松查看其速度更快或更慢的位置,添加用于在编辑器模式下操作路径的手柄...发挥创意!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

统一加速 的相关文章

  • 拉伸数组

    我有一个形成曲线的样本向量 假设其中有 1000 个点 如果我想将其拉伸到填充 1500 个点 给出不错结果的最简单算法是什么 我正在寻找一些只有几行 C C 的东西 我总是想增加向量的大小 并且新向量可以是当前向量大小的 1 1 倍到 5
  • 向 Nhibernate 发出 SQL 查询

    如何将此 SQL 查询发送给 Nhibernate SELECT Customer name FROM Company INNER JOIN Customer ON Company CompanyId Customer CompanyId
  • 如何为 C 分配的 numpy 数组注册析构函数?

    我想在 C C 中为 numpy 数组分配数字 并将它们作为 numpy 数组传递给 python 我可以做的PyArray SimpleNewFromData http docs scipy org doc numpy reference
  • 存储来自其他程序的事件

    我想将其他应用程序的事件存储在我自己的应用程序中 事件示例 打开 最小化 Word 或打开文件时 这样的事可能吗 运行程序 http msdn microsoft com en us library ms813609 aspx and 打开
  • 生成(非常)大的非重复整数序列而不进行预洗牌

    背景 我编写了一个简单的媒体客户端 服务器 我想生成一个不明显的时间值 随从客户端到服务器的每个命令一起发送 时间戳中将包含相当多的数据 纳秒分辨率 即使它不是真正准确 因为现代操作系统中计时器采样的限制 等 我想做的 在 Linux 上
  • 使用 C 语言使用 strftime() 获取缩写时区

    我看过this https stackoverflow com questions 34408909 how to get abbreviated timezone and this https stackoverflow com ques
  • 如何在 Linq 中获得左外连接?

    我的数据库中有两个表 如下所示 顾客 C ID city 1 Dhaka 2 New york 3 London 个人信息 P ID C ID Field value 1 1 First Name Nasir 2 1 Last Name U
  • 使用 JNI 从 Java 代码中检索 String 值的内存泄漏

    我使用 GetStringUTFChars 从使用 JNI 的 java 代码中检索字符串的值 并使用 ReleaseStringUTFChars 释放该字符串 当代码在 JRE 1 4 上运行时 不会出现内存泄漏 但如果相同的代码在 JR
  • 未定义的行为或误报

    我 基本上 在野外遇到过以下情况 x x 5 显然 它可以在早期版本的 gcc 下编译干净 在 gcc 4 5 1 下生成警告 据我所知 警告是由 Wsequence point 生成的 所以我的问题是 这是否违反了标准中关于在序列点之间操
  • 如何将整数转换为 void 指针?

    在 C 中使用线程时 我面临警告 警告 从不同大小的整数转换为指针 代码如下 include
  • 如何使用 Mongodb C# 驱动程序连接多个集合

    我需要将 3 个集合与多个集合合并在一起 lookup我在 C 驱动程序中尝试过 它允许我 lookup用户采集但无法执行秒 lookup用于设置集合 有人可以帮忙吗 db Transactions aggregate lookup fro
  • 如何编写一个同时需要请求和响应Dtos的ServiceStack插件

    我需要提供本地化数据服务 所有本地化的响应 Dto 都共享相同的属性 IE 我定义了一个接口 ILocalizedDto 来标记那些 Dto 在请求端 有一个ILocalizedRequest对于需要本地化的请求 Using IPlugin
  • 等待线程完成

    private void button1 Click object sender EventArgs e for int i 0 i lt 15 i Thread nova new Thread Method nova Start list
  • 私有模板函数

    我有一堂课 C h class C private template
  • 如何对 Web Api 操作进行后调用?

    我创建了一个 Web API 操作 如下所示 HttpPost public void Load string siteName string providerName UserDetails userDetails implementat
  • .NET中的LinkedList是循环链表吗?

    我需要一个循环链表 所以我想知道是否LinkedList是循环链表吗 每当您想要移动列表中的 下一个 块时 以循环方式使用它的快速解决方案 current current Next current List First 电流在哪里Linke
  • 检查Windows控制台中是否按下了键[重复]

    这个问题在这里已经有答案了 可能的重复 C 控制台键盘事件 https stackoverflow com questions 2067893 c console keyboard events 我希望 Windows 控制台程序在按下某个
  • 防止在工厂方法之外实例化对象

    假设我有一个带有工厂方法的类 class A public static A newA Some code logging return new A 是否可以使用 a 来阻止此类对象的实例化new 那么工厂方法是创建对象实例的唯一方法吗 当
  • 在客户端系统中安装后桌面应用程序无法打开

    我目前正在使用 Visual Studio 2017 和 4 6 1 net 框架 我为桌面应用程序创建了安装文件 安装程序在我的系统中完美安装并运行 问题是安装程序在其他计算机上成功安装 但应用程序无法打开 edit 在客户端系统中下载了
  • 如何正确使用 std::condition_variable?

    我很困惑conditions variables以及如何 安全 使用它们 在我的应用程序中 我有一个创建 gui 线程的类 但是当 gui 是由 gui 线程构造时 主线程需要等待 情况与下面的函数相同 主线程创建互斥体 锁和conditi

随机推荐

  • 为什么 Windows API 中的所有内容都是类型定义的?

    更具体地说 为什么是同一件事typedef在很多情况下都有多个不同的名称 为什么typedef指针类型 有时会模糊逻辑 例如 typedef const WCHAR LPCWSTR PCWSTR 这有什么意义呢 实际上这里发生了一些不同的事
  • 如何使用 gpg 命令行检查密码是否正确

    我正在尝试使用自动化备份duplicity 但是当我测试结果时 我得到 gpg 公钥解密失败 密码错误 我想检查我使用的密码是否实际上是与相应 gpg 密钥关联的密码 但无论如何我在 gpg 命令行选项中都看不到 不要加密或解密任何内容 只
  • 如何使用动态键名解析 JSON?

    我有一个像这样的 JSON 响应 array object1 aa somevalue1 bb somevalue2 cc somevalue3 object2 aa somevalue4 bb somevalue5 cc somevalu
  • Program 类应该是静态的吗? [复制]

    这个问题在这里已经有答案了 创建新的 ASP NET Core 3 项目后 我在 Visual Studio 2019 中收到以下警告 警告 CA1052 类型 Program 是静态持有者类型 但既不是静态的也不是不可继承的 public
  • Android 从媒体播放器中删除快进和快退按钮

    我想从 Android 的媒体控制器中删除快进和快退按钮 谁能帮我这个 我想在我的主要活动中完成它 创建 MediaController 时 请确保将布尔值设置为false在构造函数中 MediaController mediaContro
  • 使用 AppCompatActivity 时 onCreate() 处显示错误

    我将 SDK 更新到 22 Android 5 1 1 然后我使用AppCompactActivity代替Activity 这是 logcat 输出 04 23 13 51 40 524 E AndroidRuntime 3150 java
  • HTML 电子邮件的行高在 Outlook 2010 中不起作用

    Outlook 2010 Outlook 2007 似乎不支持我的 HTML 电子邮件中的行高 在 Outlook 00 和 Outlook 03 中完美运行 我一直在进行一些广泛的谷歌搜索 我发现 HTML CSS 支持图表表明 Outl
  • 使用Camera2(Android版本21)API录制60fps视频

    我正在尝试在 Camera2 android hardware camera2 API 上以 60 或更高 fps 的速率录制视频 最后 我使用以下命令成功以 120fps 进行录制相机约束高速捕获会话 https developer an
  • 使用模拟退火进行图形着色

    我正在尝试使用模拟退火提出图形着色问题的算法 网上有通用算法 但是当我查看它时 我无法理解如何将这个算法应用于这个问题 图中的每个节点必须具有与其邻居不同的颜色 我该如何使用模拟退火算法来实现这一点 这个问题中的 温度 时间表 是什么 请帮
  • Visual Studio 从 UML 图生成代码?

    我正在研究使用 Visual Studio 2015 从 UML 图生成代码 根据我所做的工作 我在生成代码之前创建了用例 活动 序列和类图 当我生成代码时 我发现 Visual Studio 在生成代码时仅引用我的类图 所以我的问题是 V
  • 我们如何使用旧语法进行 LEFT JOIN ?

    我们如何使用旧语法进行 LEFT JOIN 假设您有一个 User 表和 UserRole 表 并且您在 User 表中保存了 UserRole 的 ID 以下是检索所有用户名以及具有新表示法的角色名称的查询 SELECT U Userna
  • 将 Objective-C RSA 公钥导入到 c# RSACryptoServiceProvider 中

    这是我们使用以下库生成 RSA 对象的 Objective C https github com kuapay iOS Certificate Key and Trust Sample Project https github com ku
  • 传递浮点变量作为参数

    我正在尝试编写一个方法float参数并使用 PerformSelector 调用它 但我在执行此操作时遇到错误 以下是我的代码 sender performSelector selector withObject progress tota
  • eclipse ASTNode 到源代码行号

    给定eclipse中的ASTNode 有没有办法获取对应的源代码行号 您可以获取某个行的行号ASTNode使用下面的代码 int lineNumber compilationUnit getLineNumber node getStartP
  • 在 PHP 中将粗俗分数转换为数字

    如何将粗俗的分数转换为 PHP 可以用来计算其值的值 例如 3 4 l echo utf8 encode l ord l bin2hex l chr l 会输出类似这样的内容 194 c2be 我们怎样才能把它变成3 4 当从字符串中提取分
  • jQuery 按属性值过滤

    div class selectedColumns a href Driver License State a a href Email a a href Experience Level a a href First Name a a h
  • MySQL存储过程-如何获取最后插入的ID

    我创建了一个存储过程 它将一条记录插入表中并获取该记录的自动递增 ID 我在设置时遇到语法错误LAST INSERT ID 到一个变量中 ERROR 1064 42000 您的 SQL 语法有错误 检查 与您的 MySQL 服务器版本相对应
  • 通过 id 删除骨干模型?

    可以通过id删除模型吗 文档说您需要传入模型本身才能将其删除 所以我需要先获取模型然后删除它 我不能直接通过id删除它吗 您的意思是从集合中删除模型吗 查看文档 似乎您确实需要传递一个真实的模型 但源代码表明您可以只传递一个模型id或型号c
  • 具有唯一键的javascript和es6过滤器数组

    我有一个变量列表 例如 var name list some list console log name list Array 3 0 Object name Johny 1 Object name Monty 2 Object3 name
  • 统一加速

    我正在尝试在 Unity 中模拟加速和减速 我编写了代码来在 Unity 中生成轨道 并根据时间将对象放置在轨道上的特定位置 结果看起来有点像这样 我目前遇到的问题是样条线的每个部分都有不同的长度 并且立方体以不同但均匀的速度穿过每个部分