Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Vec3.cpp
00001 /* 00002 File: Vec3.cpp 00003 00004 Function: Implements Vec3.h 00005 00006 Author(s): Andrew Willmott 00007 00008 Copyright: (c) 1995-2001, Andrew Willmott 00009 00010 */ 00011 00012 00013 #include "Vec3.h" 00014 //#include <cctype> 00015 //#include <iomanip> 00016 00017 /* 00018 ostream &operator << (ostream &s, const Vec3 &v) 00019 { 00020 Int w = s.width(); 00021 00022 return(s << '[' << v[0] << ' ' << setw(w) << v[1] << ' ' << setw(w) << v[2] << ']'); 00023 } 00024 00025 istream &operator >> (istream &s, Vec3 &v) 00026 { 00027 Vec3 result; 00028 Char c; 00029 00030 // Expected format: [1 2 3] 00031 00032 while (s >> c && isspace(c)) 00033 ; 00034 00035 if (c == '[') 00036 { 00037 s >> result[0] >> result[1] >> result[2]; 00038 00039 if (!s) 00040 { 00041 cerr << "Error: Expected number while reading vector\n"; 00042 return(s); 00043 } 00044 00045 while (s >> c && isspace(c)) 00046 ; 00047 00048 if (c != ']') 00049 { 00050 s.clear(ios::failbit); 00051 cerr << "Error: Expected ']' while reading vector\n"; 00052 return(s); 00053 } 00054 } 00055 else 00056 { 00057 s.clear(ios::failbit); 00058 cerr << "Error: Expected '[' while reading vector\n"; 00059 return(s); 00060 } 00061 00062 v = result; 00063 return(s); 00064 } 00065 */
Generated on Wed Jul 13 2022 19:31:42 by
1.7.2