73void Find_Tangents (
float radius,
const Vector3 &prev_pt,
const Vector3 &curr_pt,
const Vector3 &next_pt,
const Vector3 &arc_center,
bool is_right_turn,
float *point_angle,
float *angle_in_delta,
float *angle_out_delta);
96 float delta_x = point.
X - center.
X;
97 float delta_y = point.
Y - center.
Y;
98 float dist = ::sqrt (delta_x * delta_x + delta_y * delta_y);
115 angle = base_angle - angle_offset;
117 angle = base_angle + angle_offset;
147 float result = angle1 - angle2;
150 if (angle1 < angle2) {
154 if (angle1 > angle2) {
194 float avg_angle = (angle1 + angle2) * 0.5F;
202 if (delta1 < delta2) {
203 avg_angle = angle1 - (delta1 * 0.5F);
205 avg_angle = angle1 + (delta2 * 0.5F);
213 arc_center->
Z = curr_pt.
Z;
220 (*is_right_turn) = (rel_center.
Y > 0);
240 float * angle_in_delta,
241 float * angle_out_delta
250 bool valid_in =
::Find_Tangent (arc_center, radius, prev_pt, is_right_turn, &angle_in);
251 bool valid_out =
::Find_Tangent (arc_center, radius, next_pt, !is_right_turn, &angle_out);
265 (*angle_in_delta) = 0;
272 (*angle_out_delta) =
::Get_Angle_Delta (angle_out, (*point_angle), !is_right_turn);
274 (*angle_out_delta) = 0;
317 for (
int index = 1; index < count - 1; index ++) {
326 Get_Key (index-1, &prev_pt, &time);
327 Get_Key (index, &curr_pt, &time);
328 Get_Key (index+1, &next_pt, &time);
339 Vector3 x_vector (curr_pt - last_path_pt);
342#ifdef ALLOW_TEMPORARIES
348 Matrix3D tm (x_vector, y_vector, z_vector, last_path_pt);
354 bool is_right_turn =
false;
367 float angle_in_delta = 0;
368 float angle_out_delta = 0;
369 float point_angle = 0;
402 arc_info.
center = curr_pt;
417 arc_info.
center = arc_center;
456 int count =
Keys.Count ();
459 if (time <
Keys[0].Time) {
460 *set_val =
Keys[0].Point;
465 if (time >=
Keys[count - 1].Time) {
466 *set_val =
Keys[count - 1].Point;
499 float total_length = arc_length0 + arc_length1 + other_length;
504 float time1 = arc_length0 / total_length;
505 float time2 = (arc_length0 + other_length) / total_length;
510 if (seg_time < time1) {
530 }
else if (seg_time < time2) {
536 float percent = (seg_time - time1) / (time2 - time1);
582 set_val->
Z =
Keys[index0].Point.Z + (
Keys[index1].Point.Z -
Keys[index0].Point.Z) * seg_time;
617 for (
int index = 0; index <
m_ArcList.Count (); index ++) {
621 csave.
Write (&arc_info,
sizeof (arc_info));
647 cload.
Read (&arc_info,
sizeof (arc_info));
#define WRITE_MICRO_CHUNK(csave, id, var)
#define READ_MICRO_CHUNK(cload, id, var)
uint32 Cur_Micro_Chunk_ID()
uint32 Read(void *buf, uint32 nbytes)
uint32 Write(const void *buf, uint32 nbytes)
bool Begin_Chunk(uint32 id)
virtual int Key_Count(void)
void Find_Interval(float time, int *i0, int *i1, float *t)
virtual bool Load(ChunkLoadClass &cload)
virtual bool Save(ChunkSaveClass &csave)
virtual void Get_Key(int i, Vector3 *set_point, float *set_t)
DynamicVectorClass< KeyClass > Keys
static WWINLINE void Inverse_Transform_Vector(const Matrix3D &tm, const Vector3 &in, Vector3 *out)
static WWINLINE void Cross_Product(const Vector3 &a, const Vector3 &b, Vector3 *result)
void Evaluate(float time, Vector3 *set_val)
virtual bool Save(ChunkSaveClass &csave)
struct VehicleCurveClass::_ArcInfoStruct ArcInfoStruct
void Load_Variables(ChunkLoadClass &cload)
virtual const PersistFactoryClass & Get_Factory(void) const
void Update_Arc_List(void)
virtual bool Load(ChunkLoadClass &cload)
static float Wrap(float val, float min=0.0f, float max=1.0f)
static float Clamp(float val, float min=0.0f, float max=1.0f)
static WWINLINE float Acos(float val)
static float Atan2(float y, float x)
static WWINLINE float Fabs(float val)
static float Sin(float val)
static float Cos(float val)
SimplePersistFactoryClass< VehicleCurveClass, WWMATH_CHUNKID_VEHICLECURVE > _VehicleCurveFactory
bool Find_Tangent(const Vector3 ¢er, float radius, const Vector3 &point, bool clockwise, float *result)
void Find_Tangents(float radius, const Vector3 &prev_pt, const Vector3 &curr_pt, const Vector3 &next_pt, const Vector3 &arc_center, bool is_right_turn, float *point_angle, float *angle_in_delta, float *angle_out_delta)
void Find_Turn_Arc(const Matrix3D &transform, float radius, const Vector3 &prev_pt, const Vector3 &curr_pt, const Vector3 &next_pt, Vector3 *arc_center, bool *is_right_turn)
float Get_Angle_Delta(float angle1, float angle2, bool clockwise)
#define WWMEMLOG(category)