58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
/*
|
|
一些路径生成器
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief 生成一条直线段的路径点
|
|
* @param start 起始点
|
|
* @param end 结束点
|
|
* @param t 时间路径点,范围[0, 1]
|
|
* @param out 输出路径点
|
|
*/
|
|
void Path_Straight2d(float start[2], float end[2], float t, float out[2]);
|
|
|
|
/**
|
|
* @brief 生成一条三维直线段的路径点
|
|
* @param start 起始点
|
|
* @param end 结束点
|
|
* @param t 时间路径点,范围[0, 1]
|
|
* @param out 输出路径点
|
|
*/
|
|
void Path_straight3d(float start[3], float end[3], float t, float out[3]);
|
|
|
|
/**
|
|
* @brief 生成一条二次贝塞尔曲线的路径点
|
|
* @param start 起始点
|
|
* @param mid 中间控制点
|
|
* @param end 结束点
|
|
* @param t 时间路径点,范围[0, 1]
|
|
* @param out 输出路径点
|
|
*/
|
|
void Path_Bezier2d(float start[2], float mid[2], float end[2], float t, float out[2]);
|
|
|
|
/**
|
|
* @brief 生成一条三次贝塞尔曲线的路径点
|
|
* @param start 起始点
|
|
* @param mid1 中间控制点1
|
|
* @param mid2 中间控制点2
|
|
* @param end 结束点
|
|
* @param t 时间路径点,范围[0, 1]
|
|
* @param out 输出路径点
|
|
*/
|
|
void Path_Bezier3d(float start[3], float mid1[3], float mid2[3], float end[3], float t, float out[3]);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |