29 Commits
Author SHA1 Message Date
Goober5000 86f75c5d17 fix normalized vector handling (#6650)
Although normalized vectors in FSO are supposed to stay normalized, occasionally small floating point errors can pop up.  In most cases these do not cause a problem, but in certain cases these errors can rapidly accumulate and corrupt an otherwise well-behaved matrix.  This can most easily be seen with daisy-chained dock sequences or docked ships with angled dockpoints.

This PR audits the usage of `vm_vector_2_matrix_norm` to re-normalize vectors in cases where floating point errors could accumulate.  There are also a few new Assertions for extra vigilance.

Follow-up to #6596.  Fixes #6634.
2025-03-28 23:54:51 +01:00
Goober5000 4797ce55a2 use vm_vector_2_matrix_norm on normalized vectors
Most places in the code that use `vm_vector_2_matrix` do so on already-normalized vectors.  Changing these to `vm_vector_2_matrix_norm` avoids redundant normalization.
2025-03-02 23:07:09 -05:00
Joshua Glatt 144d484c85 Replace rand() calls with a Random class (#3332) 2021-05-04 18:26:06 -07:00
Phantom Hoover 640640b4b4 Properly fix static_rand()'s range and account for this in functions that were misusing it 2021-02-13 16:06:47 +00:00
Baezon 32baf3dc5c Even more appveyor appeasement 2020-07-10 20:23:36 -04:00
Baezon 453a3f213d Merge The_E's vector test functions 2020-07-09 20:39:19 -04:00
David Gibson 536e97592d minor style fixes 2020-06-06 13:17:12 -05:00
David Gibson 025cf3c7b9 converted some NULL pointers to nullptr as travis commands 2020-06-06 10:11:46 -05:00
David Gibson b7aeb763f3 fixed my misunderstanding of the const changes in static_rand_cone 2020-06-05 21:38:06 -05:00
David Gibson 9ec63f0882 fixed inconsistent constness in the new overload for static_rand_cone, and added constness to the existing version. 2020-06-05 21:38:06 -05:00
David Gibson a20096abfa added min-angle supporting version of static_rand_cone 2020-06-05 21:38:06 -05:00
CasparKielwein c3a51296f8 make internal variables in static rand unsigned.
several of the bitwise manipulations on signed integers are technically undefined behaviour.
I made the internal variables unsigned and the results are then converted to signed ints as before.
This should not actually change any observable results.

Did some cleanup as well, while I was at it.
2019-12-23 10:52:33 +01:00
Echelon9 97a134e51f Simplify duplicative math/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 d52f90c076 First version of our Documentation system, using automated Doxygen source code comments 2011-02-26 01:15:51 +00:00
Echelon9 d549d06728 DOC: Further instructions on initialisation of the pseudo random number generator 2011-02-22 12:05:31 +00:00
Echelon9 80d622f56f A couple of other small changes to staticrand.cpp|h to address readability 2011-02-21 14:13:23 +00:00
Echelon9 1c687e4b4e Initial testing of something very exciting for the coders... 2011-02-21 12:50:16 +00:00
Goober5000 d57ab51162 change fl_radian to fl_radians so as to be consistent 2010-12-31 04:02:41 +00:00
The_E b192612b57 More checking to guard against Mantis 2205 2010-10-03 20:35:48 +00:00
The_E c1f1c47fa8 Patch for Mantis 2205 (Division by zero in do_random_sidethrust()) 2010-07-10 15:06:33 +00:00
Sushi 9246a2f74d Additional AI code, including stuff taking advantage of glide and sidethrust. Includes: Flag for allowing fighters to dodge vertically as well as horizontally, "stalemate detection" to help AI break out of circle fights and other stalemate situations, "glide attack" where AI fighters will use glide to fly away while shooting back at you, "circle strafe" where AI fighters will use sidethrusters to jink around while shooting, and an (incomplete) version of "glide strafe" that allows fighters/bombers to use glide to attack capital ships. All new stuff is off by default, and can be turned on with AI_Profiles flags. 2009-07-13 20:08:32 +00:00
portej05 719825f80d The big CVS comment removal. This chops approx. 3.5mb off a full checkout.
I've tested this through compiling and through hand checking. 
Normalises line endings in ALL files to \n.
2009-06-20 08:08:20 +00:00
taylor 7f786136a6 s/vector/vec3d/g, better support for different compilers (Jens Granseuer) 2005-04-05 05:53:25 +00:00
Kazan 864e1b5922 remove MCD complete 2004-07-26 20:47:56 +00:00
Kazan 428b3dcbc9 MCD - define _MCD_CHECK to use memory tracking 2004-07-12 16:33:09 +00:00
phreak de2e849fc6 added static_random_cone which is used for spawn angle features in multi 2004-06-05 19:14:42 +00:00
penguin 0c503be8d1 The big include file move 2002-08-01 01:41:11 +00:00
penguin 8f92eebd34 Warpcore CVS sync 2002-06-03 04:10:40 +00:00
penguin 663b3471b9 Volition sources -- warpcore CVS import 2002-06-03 03:26:03 +00:00