All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

BUG-540: Math updates by Moon Metty. Reviewed by Chieron Tenk.

Review Request #606 - Created Oct. 24, 2012 and updated

MartinRJ Fayray Reviewers
3.4.0 viewer
BUG-540
None viewer-release
Improved functions:
getEulerAngles ( now: setQuat(F32 roll, F32 pitch, F32 yaw) )
packToVector3
getAngleAxis
setAngleAxis
shortestArc
projected_vec
angle_between

For details please see: http://jira.phoenixviewer.com/browse/FIRE-7989
and http://jira.phoenixviewer.com/browse/FIRE-7997
Please go to https://jira.secondlife.com/browse/BUG-540

Diff revision 2 (Latest)

1 2
1 2

  1. indra/llmath/llmath.h: Loading...
  2. indra/llmath/llquaternion.h: Loading...
  3. indra/llmath/llquaternion.cpp: Loading...
  4. indra/llmath/v3math.h: Loading...
indra/llmath/llmath.h
Revision f32c39fdfcfe New Change
1
/** 
1
/**
2
 * @file llmath.h
2
 * @file llmath.h
3
 * @brief Useful math constants and macros.
3
 * @brief Useful math constants and macros.
4
 *
4
 *
5
 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
5
 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
6
 * Second Life Viewer Source Code
6
 * Second Life Viewer Source Code
7
 * Copyright (C) 2010, Linden Research, Inc.
7
 * Copyright (C) 2010, Linden Research, Inc.
8
 * 
8
 * 
9
 * This library is free software; you can redistribute it and/or
9
 * This library is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Lesser General Public
10
 * modify it under the terms of the GNU Lesser General Public
11
 * License as published by the Free Software Foundation;
11
 * License as published by the Free Software Foundation;
... 62 lines hidden [Expand]
const F32	F_SQRT2		= 1.4142135623730950488016887242097f;
74
const F32	OO_SQRT2	= 0.7071067811865475244008443621049f;
74
const F32	OO_SQRT2	= 0.7071067811865475244008443621049f;
75
const F32	DEG_TO_RAD	= 0.017453292519943295769236907684886f;
75
const F32	DEG_TO_RAD	= 0.017453292519943295769236907684886f;
76
const F32	RAD_TO_DEG	= 57.295779513082320876798154814105f;
76
const F32	RAD_TO_DEG	= 57.295779513082320876798154814105f;
77
const F32	F_APPROXIMATELY_ZERO = 0.00001f;
77
const F32	F_APPROXIMATELY_ZERO = 0.00001f;
78
const F32	F_LN2		= 0.69314718056f;
78
const F32	F_LN2		= 0.69314718056f;
79
const F32	OO_LN2		= 1.4426950408889634073599246810019f;
79
const F32	OO_LN2		= 1.4426950408889634073599246810019f;
80

   
80

   
81
const F32	F_ALMOST_ZERO	= 0.0001f;
81
const F32	F_ALMOST_ZERO	= 0.0001f;
82
const F32	F_ALMOST_ONE	= 1.0f - F_ALMOST_ZERO;
82
const F32	F_ALMOST_ONE	= 1.0f - F_ALMOST_ZERO;
83

   
83

   

   
84
const F32	GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees

   
85
// formula: GIMBAL_THRESHOLD = sin(DEG_TO_RAD * gimbal_threshold_angle);

   
86

   
84
// BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above?
87
// BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above?
85
const F32 FP_MAG_THRESHOLD = 0.0000001f;
88
const F32 FP_MAG_THRESHOLD = 0.0000001f;
86

   
89

   
87
// TODO: Replace with logic like is_approx_equal
90
// TODO: Replace with logic like is_approx_equal
88
inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); }
91
inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); }
89

   
92

   
90
// These functions work by interpreting sign+exp+mantissa as an unsigned
93
// These functions work by interpreting sign+exp+mantissa as an unsigned
91
// integer.
94
// integer.
92
// For example:
95
// For example:
93
// x = <sign>1 <exponent>00000010 <mantissa>00000000000000000000000
96
// x = <sign>1 <exponent>00000010 <mantissa>00000000000000000000000
... 456 lines hidden [Expand]
indra/llmath/llquaternion.h
Revision f32c39fdfcfe New Change
 
indra/llmath/llquaternion.cpp
Revision f32c39fdfcfe New Change
 
indra/llmath/v3math.h
Revision f32c39fdfcfe New Change
 
  1. indra/llmath/llmath.h: Loading...
  2. indra/llmath/llquaternion.h: Loading...
  3. indra/llmath/llquaternion.cpp: Loading...
  4. indra/llmath/v3math.h: Loading...