Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some math functions now prefixed with std:: #7918

Merged
merged 107 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
e5e119d
MAX to std::fmax
dimitre Apr 29, 2024
84f8581
now math macros are optional
dimitre Apr 29, 2024
b7aa653
opencv update
dimitre Apr 29, 2024
d415888
sin, cos, acos, atan2, atan, abs, ceil, floor, round, pow to std
dimitre Apr 29, 2024
355f2b5
fixes
dimitre Apr 29, 2024
c0fee7b
one fix
dimitre Apr 29, 2024
997703c
ios fix
dimitre Apr 29, 2024
88ad9ed
fix for msys2
dimitre Apr 29, 2024
40659ac
fix ios
dimitre Apr 29, 2024
7ba2a0b
try to fix ios, remove ofMath.h includes
dimitre Apr 29, 2024
76039c6
testing multistrap bookworm instead of bullseye
dimitre Apr 29, 2024
06c8877
more multistrap tests
dimitre Apr 29, 2024
95ac5c0
test without firmware rpi
dimitre Apr 30, 2024
35c65b0
ok more fix
dimitre Apr 30, 2024
4d84729
one workflow
dimitre Apr 30, 2024
1c95c43
remove comments
dimitre Apr 30, 2024
6e8c9ab
error fix
dimitre Apr 30, 2024
79fbcde
one more fix
dimitre Apr 30, 2024
ddb88ef
revert multistrap changes
dimitre Apr 30, 2024
26d9ddc
more headers include removal
dimitre Apr 30, 2024
93468f1
more headers include removal
dimitre Apr 30, 2024
b69ab82
fabs to std::abs
dimitre Apr 30, 2024
9fcfe67
sqrt fix
dimitre Apr 30, 2024
195a741
fix std::sqrtf
dimitre Apr 30, 2024
8727ffb
fmod
dimitre Apr 30, 2024
293fbee
cmath fix
dimitre Apr 30, 2024
f7f5000
try to fix ofMaterial
dimitre Apr 30, 2024
242b895
quiet some -Wsign-compare warnings
dimitre Apr 30, 2024
2702e22
jobs
dimitre Apr 30, 2024
ff92106
test
dimitre Apr 30, 2024
c60d2ad
test fix
dimitre Apr 30, 2024
bce0a44
remove ubuntu libgconf-2-4?
dimitre Apr 30, 2024
b22e9e5
examples fix
dimitre May 1, 2024
1570534
RAD_TO_DEG in examples
dimitre May 1, 2024
d1bd159
multistrap update
dimitre May 2, 2024
243f3be
update examples constants
dimitre May 2, 2024
0c80c25
more
dimitre May 2, 2024
01afadb
Merge branch 'openframeworks:master' into svgmax
dimitre May 2, 2024
185b735
Merge branch 'openframeworks:master' into svgmax
dimitre May 2, 2024
e905ca9
update install.sh to test rpi actions
dimitre May 2, 2024
b347914
more rpi tests
dimitre May 2, 2024
a867ab1
aarch64 only
dimitre May 2, 2024
08f81ca
g++
dimitre May 2, 2024
d5ef1d9
paths
dimitre May 2, 2024
0d6db17
test
dimitre May 2, 2024
b0b89d4
test
dimitre May 2, 2024
c7412fc
simpler actions
dimitre May 2, 2024
a019136
ccache
dimitre May 2, 2024
6986ab7
disable ccache
dimitre May 2, 2024
f46def6
disable ccache #2
dimitre May 2, 2024
3abc346
no download libs
dimitre May 2, 2024
286e4d5
fix checkout
dimitre May 2, 2024
88bda2b
remove install gcc-aarch64-linux-gnu via apt get
dimitre May 2, 2024
6fb48dc
fix checkout
dimitre May 2, 2024
949e3f0
fix cairo path
dimitre May 2, 2024
7ccc2a2
updates
dimitre May 2, 2024
d6b14ab
srv folder
dimitre May 2, 2024
ac7b48f
srv
dimitre May 2, 2024
1c6a60d
srv
dimitre May 2, 2024
4fc7c1d
~
dimitre May 2, 2024
f1ce315
~
dimitre May 2, 2024
dd7cc3f
remove install downloader
dimitre May 2, 2024
05b05cd
actions less
dimitre May 2, 2024
1355841
unsecure again
dimitre May 2, 2024
cf6f4d0
more tests
dimitre May 2, 2024
eb5b2a5
debug CORE_PKG_CONFIG_LIBRARIES
dimitre May 2, 2024
b701fe5
updates
dimitre May 2, 2024
0da94d3
fix
dimitre May 2, 2024
c055857
up
dimitre May 2, 2024
3cf1d1e
up
dimitre May 2, 2024
2441f73
now checking makefiles
dimitre May 2, 2024
ef52bfd
cross
dimitre May 2, 2024
ebf4017
cross
dimitre May 2, 2024
51b12ff
update actions
dimitre May 2, 2024
8d0d33e
download libs again
dimitre May 2, 2024
de118fe
one more teest
dimitre May 2, 2024
b2b3035
advance tests. multiple archs
dimitre May 3, 2024
a101e5f
fixes
dimitre May 3, 2024
b0213dc
cleanup
dimitre May 3, 2024
ea4a72a
modularization
dimitre May 3, 2024
aba0f6f
remove legacy 32bit rpi
dimitre May 3, 2024
50b9340
up
dimitre May 3, 2024
8090145
fix
dimitre May 3, 2024
63c420c
fix
dimitre May 3, 2024
1d967e0
fix
dimitre May 3, 2024
e24703f
update allexamples libs needed
dimitre May 3, 2024
8b96eca
update allexamples libs needed
dimitre May 3, 2024
03c8993
update allexamples libs needed
dimitre May 3, 2024
b8ec74b
update allexamples libs needed
dimitre May 3, 2024
2087517
up;
dimitre May 3, 2024
a16e2b1
up;
dimitre May 3, 2024
a986e75
up
dimitre May 3, 2024
fae32b0
up
dimitre May 3, 2024
3fa98b6
testing
dimitre May 3, 2024
6686840
maybe fix armv6l
dimitre May 3, 2024
a96942d
test bcm drivers
dimitre May 3, 2024
2b67865
remove libraspberrypi-dev
dimitre May 3, 2024
92d001d
changes
dimitre May 3, 2024
157835c
split some tests in other PRs
dimitre May 4, 2024
4a18017
revert mk to regular, separate PR for mk files
dimitre May 4, 2024
564507e
Merge branch 'openframeworks:master' into svgmax
dimitre May 6, 2024
9dde3d6
fix error
dimitre May 7, 2024
5e5051a
Merge branch 'openframeworks:master' into svgmax
dimitre May 7, 2024
42e55a2
Merge branch 'openframeworks:master' into svgmax
dimitre May 7, 2024
124a460
fixes
dimitre May 7, 2024
5e6de8b
up
dimitre May 7, 2024
86452be
OF_USE_LEGACY_MATH_MACROS defined
dimitre May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/ofxAccelerometer/src/ofxAccelerometer.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ class ofxAccelerometerHandler {
if(!orientDirty) return;
orientDirty = false;

orientation.x = atan2(accelOrientation.y, -accelOrientation.z) * RAD_TO_DEG;
orientation.y = atan2(accelOrientation.x, -accelOrientation.z) * RAD_TO_DEG;
orientation.x = glm::degrees( atan2(accelOrientation.y, -accelOrientation.z) );
orientation.y = glm::degrees( atan2(accelOrientation.x, -accelOrientation.z) );
orientation.z = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion addons/ofxAssimpModelLoader/src/ofxAssimpAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void ofxAssimpAnimation::update() {
position = 1.0;
stop();
} else if(position > 1.0 && loopType == OF_LOOP_NORMAL) {
position = fmod(position, 1.0f);
position = std::fmod(position, 1.0f);
} else if(position > 1.0 && loopType == OF_LOOP_PALINDROME) {
speedFactor *= -1;
} else if(position < 0.0 && loopType == OF_LOOP_PALINDROME) {
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void ofxAssimpModelLoader::calculateDimensions(){
normalizedScale = scene_max.x-scene_min.x;
normalizedScale = std::max(double(scene_max.y - scene_min.y), normalizedScale);
normalizedScale = std::max(double(scene_max.z - scene_min.z), normalizedScale);
if (fabs(normalizedScale) < std::numeric_limits<float>::epsilon()){
if (std::abs(normalizedScale) < std::numeric_limits<float>::epsilon()){
ofLogWarning("ofxAssimpModelLoader") << "Error calculating normalized scale of scene" << std::endl;
normalizedScale = 1.0;
} else {
Expand Down
14 changes: 7 additions & 7 deletions addons/ofxGui/src/ofxColorPicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ PolCord getPolarCoordinate(const glm::vec2 & p, float radius){

float px = p.x - radius; // point x from center.
float py = p.y - radius; // point x from center.
float pl = sqrt(px * px + py * py); // point length from center.
float pa = atan2(px, py); // point angle around center.
float pl = std::sqrt(px * px + py * py); // point length from center.
float pa = std::atan2(px, py); // point angle around center.

pa *= RAD_TO_DEG;
pa = glm::degrees(pa);
pa -= 90;
pl /= radius;

Expand All @@ -39,8 +39,8 @@ PolCord getPolarCoordinate(const glm::vec2 & p, float radius){

glm::vec2 getPoint(float a, float r){
glm::vec2 p;
p.x = r * cos(-a * DEG_TO_RAD);
p.y = r * sin(-a * DEG_TO_RAD);
p.x = r * std::cos(glm::radians(-a));
p.y = r * std::sin(glm::radians(-a));

return p;
}
Expand Down Expand Up @@ -248,9 +248,9 @@ ofMesh ofxColorPicker_<ColorType>::getColorWheel() {

int j = i % COLOR_WHEEL_RES;
float p = j / (float)COLOR_WHEEL_RES;
float a = p * TWO_PI;
float a = p * glm::two_pi<float>();

ofFloatColor c0 = getCircularColor<float>(a * RAD_TO_DEG, 1.0, colorScale);
ofFloatColor c0 = getCircularColor<float>(glm::degrees(a), 1.0, colorScale);
meshColorWheel.addColor(ofFloatColor::white);
meshColorWheel.addColor(c0);
meshColorWheel.addColor(c0);
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxKinect/src/ofxKinect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ void ofxKinect::update() {
if( videoPixels.getHeight() == videoPixelsIntra.getHeight() ){
std::swap(videoPixels,videoPixelsIntra);
}else{
int minimumSize = MIN(videoPixels.size(), videoPixelsIntra.size());
int minimumSize = std::min(videoPixels.size(), videoPixelsIntra.size());
memcpy(videoPixels.getData(), videoPixelsIntra.getData(), minimumSize);
}
bNeedsUpdateVideo = false;
Expand Down
4 changes: 2 additions & 2 deletions addons/ofxOpenCv/src/ofxCvImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,8 @@ void ofxCvImage::transform( float angle, float centerX, float centerY,
return;
}

float sina = sin(angle * DEG_TO_RAD);
float cosa = cos(angle * DEG_TO_RAD);
float sina = std::sin(glm::radians(angle));
float cosa = std::cos(glm::radians(angle));
CvMat* transmat = cvCreateMat( 2,3, CV_32F );
cvmSet( transmat, 0,0, scaleX*cosa );
cvmSet( transmat, 0,1, scaleY*sina );
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxSvg/src/ofxSvg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void ofxSvg::fixSvgString(std::string & xmlstring) {
for (ofXml & element : strokeWidthElements) {
//cout << element.toString() << endl;
float strokewidth = element.getAttribute("stroke-width").getFloatValue();
strokewidth = MAX(1, round(strokewidth));
strokewidth = std::fmax(1.0, std::round(strokewidth));
element.getAttribute("stroke-width").set(strokewidth);
}
}
Expand Down
6 changes: 3 additions & 3 deletions addons/ofxiOS/src/core/ofxiOSGLKViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ - (float)rotationForOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
return 0; // 0 degrees.
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
return M_PI * 0.5; // 90 degrees.
return glm::half_pi<float>(); // 90 degrees.
} else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
return M_PI; // 180 degrees.
return glm::pi<float>(); // 180 degrees.
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
return M_PI * 1.5; // 270 degrees.
return glm::pi<float>() + glm::half_pi<float>(); // 270 degrees.
} else {
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions addons/ofxiOS/src/core/ofxiOSViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ - (float)rotationForOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
return 0; // 0 degrees.
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
return M_PI * 0.5; // 90 degrees.
return glm::half_pi<float>(); // 90 degrees.
} else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
return M_PI; // 180 degrees.
return glm::pi<float>(); // 180 degrees.
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
return M_PI * 1.5; // 270 degrees.
return glm::pi<float>() + glm::half_pi<float>(); // 270 degrees.
} else {
return 0;
}
Expand Down
22 changes: 11 additions & 11 deletions addons/ofxiOS/src/utils/ofxiOSImagePicker.mm
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ - (instancetype) initWithPicker:(canLoadPixels *) _picker
*/
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == UIInterfaceOrientationLandscapeLeft) {
_imagePicker.view.transform = CGAffineTransformMakeRotation(-PI*0.5);
_imagePicker.view.transform = CGAffineTransformMakeRotation(-glm::half_pi<float>());
} else if(orientation == UIInterfaceOrientationLandscapeRight) {
_imagePicker.view.transform = CGAffineTransformMakeRotation(PI*0.5);
_imagePicker.view.transform = CGAffineTransformMakeRotation(glm::half_pi<float>());
} else if(orientation == UIInterfaceOrientationPortraitUpsideDown) {
_imagePicker.view.transform = CGAffineTransformMakeRotation(PI);
_imagePicker.view.transform = CGAffineTransformMakeRotation(glm::pi<float>());
}
}

Expand Down Expand Up @@ -330,11 +330,11 @@ - (BOOL) showCameraOverlayWithCustomView:(UIView *)overlayView {
overlay.center = CGPointMake(screenSize.width * 0.5, screenSize.height * 0.5);
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == UIInterfaceOrientationLandscapeLeft) {
overlay.transform = CGAffineTransformMakeRotation(-PI * 0.5);
overlay.transform = CGAffineTransformMakeRotation(-glm::half_pi<float>());
} else if(orientation == UIInterfaceOrientationLandscapeRight) {
overlay.transform = CGAffineTransformMakeRotation(PI * 0.5);
overlay.transform = CGAffineTransformMakeRotation(glm::half_pi<float>());
} else if(orientation == UIInterfaceOrientationPortraitUpsideDown) {
overlay.transform = CGAffineTransformMakeRotation(PI);
overlay.transform = CGAffineTransformMakeRotation(glm::pi<float>());
}
}

Expand Down Expand Up @@ -458,7 +458,7 @@ - (UIImage *)scaleAndRotateImage:(UIImage *)image {
break;
case UIImageOrientationDown:
transform = CGAffineTransformMakeTranslation(imageSize.width, imageSize.height);
transform = CGAffineTransformRotate(transform, M_PI);
transform = CGAffineTransformRotate(transform, glm::pi<float>());
break;
case UIImageOrientationDownMirrored:
transform = CGAffineTransformMakeTranslation(0.0, imageSize.height);
Expand All @@ -470,28 +470,28 @@ - (UIImage *)scaleAndRotateImage:(UIImage *)image {
bounds.size.width = boundHeight;
transform = CGAffineTransformMakeTranslation(imageSize.height, imageSize.width);
transform = CGAffineTransformScale(transform, -1.0, 1.0);
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
transform = CGAffineTransformRotate(transform, glm::pi<float>() + glm::half_pi<float>());
break;
case UIImageOrientationLeft:
boundHeight = bounds.size.height;
bounds.size.height = bounds.size.width;
bounds.size.width = boundHeight;
transform = CGAffineTransformMakeTranslation(0.0, imageSize.width);
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
transform = CGAffineTransformRotate(transform, glm::pi<float>() + glm::half_pi<float>());
break;
case UIImageOrientationRightMirrored:
boundHeight = bounds.size.height;
bounds.size.height = bounds.size.width;
bounds.size.width = boundHeight;
transform = CGAffineTransformMakeScale(-1.0, 1.0);
transform = CGAffineTransformRotate(transform, M_PI / 2.0);
transform = CGAffineTransformRotate(transform, glm::half_pi<float>());
break;
case UIImageOrientationRight:
boundHeight = bounds.size.height;
bounds.size.height = bounds.size.width;
bounds.size.width = boundHeight;
transform = CGAffineTransformMakeTranslation(imageSize.height, 0.0);
transform = CGAffineTransformRotate(transform, M_PI / 2.0);
transform = CGAffineTransformRotate(transform, glm::half_pi<float>());
break;
default:
[NSException raise:NSInternalInconsistencyException format:@"Invalid image orientation"];
Expand Down
6 changes: 3 additions & 3 deletions addons/ofxiOS/src/utils/ofxiOSKeyboard.mm
Original file line number Diff line number Diff line change
Expand Up @@ -370,23 +370,23 @@ - (void) setFrame: (CGRect) rect
switch (ofGetOrientation())
{
case OF_ORIENTATION_90_LEFT:
_textField.transform = CGAffineTransformMakeRotation(M_PI_2);
_textField.transform = CGAffineTransformMakeRotation(glm::half_pi<float>());
x = rect.origin.y-rect.size.height;
y = s.height-rect.size.width-rect.origin.x;
w = rect.size.height;
h = rect.size.width;
break;

case OF_ORIENTATION_90_RIGHT:
_textField.transform = CGAffineTransformMakeRotation(-M_PI_2);
_textField.transform = CGAffineTransformMakeRotation(-glm::half_pi<float>());
x = s.width-rect.origin.y;
y = rect.origin.x;
w = rect.size.height;
h = rect.size.width;
break;

case OF_ORIENTATION_180:
_textField.transform = CGAffineTransformMakeRotation(M_PI);
_textField.transform = CGAffineTransformMakeRotation(glm::pi<float>());
x = rect.origin.x;
y = rect.origin.y-rect.size.height;
w = rect.size.width;
Expand Down
4 changes: 2 additions & 2 deletions addons/ofxiOS/src/video/AVFoundationVideoGrabber.mm
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,13 @@ - (void)eraseGrabberPtr {

if(ofGetOrientation() == OF_ORIENTATION_DEFAULT) {
transform = CGAffineTransformMakeTranslation(0.0, height);
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
transform = CGAffineTransformRotate(transform, glm::half_pi<float>() + glm::pi<float>());

CGContextConcatCTM(spriteContext, transform);
CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)height, (CGFloat)width), ref);
} else if(ofGetOrientation() == OF_ORIENTATION_180) {
transform = CGAffineTransformMakeTranslation(width, 0.0);
transform = CGAffineTransformRotate(transform, M_PI / 2.0);
transform = CGAffineTransformRotate(transform, glm::half_pi<float>());

CGContextConcatCTM(spriteContext, transform);
CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)height, (CGFloat)width), ref);
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/3DPrimitivesExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void ofApp::draw() {
ofPushMatrix();
if (bottomCap.getNumNormals() > 0) {
ofTranslate(bottomCap.getNormal(0) * cone.getHeight()*.5);
ofRotateDeg(sin(ofGetElapsedTimef() * 5) * RAD_TO_DEG, 1, 0, 0);
ofRotateDeg( glm::degrees( sin(ofGetElapsedTimef() * 5) ), 1, 0, 0);
bottomCap.draw();
}
ofPopMatrix();
Expand Down
8 changes: 4 additions & 4 deletions examples/android/androidAudioExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void ofApp::touchMoved(int x, int y, int id){
float height = (float)ofGetHeight();
float heightPct = ((height-y) / height);
targetFrequency = 2000.0f * heightPct;
phaseAdderTarget = (targetFrequency / (float) sampleRate) * TWO_PI;
phaseAdderTarget = (targetFrequency / (float) sampleRate) * glm::two_pi<float>();
}

//--------------------------------------------------------------
Expand Down Expand Up @@ -153,9 +153,9 @@ void ofApp::audioOut(ofSoundBuffer & buffer){
float rightScale = pan;

// sin (n) seems to have trouble when n is very large, so we
// keep phase in the range of 0-TWO_PI like this:
while (phase > TWO_PI){
phase -= TWO_PI;
// keep phase in the range of 0-glm::two_pi<float>() like this:
while (phase > glm::two_pi<float>()){
phase -= glm::two_pi<float>();
}

if ( bNoise == true){
Expand Down
30 changes: 15 additions & 15 deletions examples/android/androidPolygonExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ofApp::draw(){
float yPct = (float)(mouseY) / (float)(ofGetHeight());
int nTips = 5 + xPct * 60;
int nStarPts = nTips * 2;
float angleChangePerPt = TWO_PI / (float)nStarPts;
float angleChangePerPt = glm::two_pi<float>() / (float)nStarPts;
float innerRadius = 0 + yPct*80;
float outerRadius = 80;
float origx = 525;
Expand All @@ -114,13 +114,13 @@ void ofApp::draw(){
for (int i = 0; i < nStarPts; i++){
if (i % 2 == 0) {
// inside point:
float x = origx + innerRadius * cos(angle);
float y = origy + innerRadius * sin(angle);
float x = origx + innerRadius * std::cos(angle);
float y = origy + innerRadius * std::sin(angle);
ofVertex(x,y);
} else {
// outside point
float x = origx + outerRadius * cos(angle);
float y = origy + outerRadius * sin(angle);
float x = origx + outerRadius * std::cos(angle);
float y = origy + outerRadius * std::sin(angle);
ofVertex(x,y);
}
angle += angleChangePerPt;
Expand Down Expand Up @@ -155,13 +155,13 @@ void ofApp::draw(){
ofFill();
ofSetPolyMode(OF_POLY_WINDING_ODD);
ofBeginShape();
float angleStep = TWO_PI/(100.0f + sin(ofGetElapsedTimef()/5.0f) * 60);
float angleStep = glm::two_pi<float>()/(100.0f + std::sin(ofGetElapsedTimef()/5.0f) * 60);
float radiusAdder = 0.5f;
float radius = 0;
for (int i = 0; i < 200; i++){
float anglef = (i) * angleStep;
float x = radius * cos(anglef);
float y = radius * sin(anglef);
float x = radius * std::cos(anglef);
float y = radius * std::sin(anglef);
ofVertex(x,y);
radius += radiusAdder;
}
Expand Down Expand Up @@ -325,9 +325,9 @@ void ofApp::draw(){
ofNextContour(true);

for (int i = 0; i < 20; i++){
float anglef = ((float)i / 19.0f) * TWO_PI;
float x = 340 + 30 * cos(anglef);
float y = 550 + 30 * sin(anglef);
float anglef = ((float)i / 19.0f) * glm::two_pi<float>();
float x = 340 + 30 * std::cos(anglef);
float y = 550 + 30 * std::sin(anglef);
ofVertex(x,y);
radius += radiusAdder;
}
Expand All @@ -347,9 +347,9 @@ void ofApp::draw(){
ofNextContour(true);

for (int i = 0; i < 20; i++){
float anglef = ((float)i / 19.0f) * TWO_PI;
float x = 340 + 30 * cos(anglef);
float y = 550 + 30 * sin(anglef);
float anglef = ((float)i / 19.0f) * glm::two_pi<float>();
float x = 340 + 30 * std::cos(anglef);
float y = 550 + 30 * std::sin(anglef);
ofVertex(x,y);
radius += radiusAdder;
}
Expand All @@ -365,7 +365,7 @@ void ofApp::draw(){
ofNextContour(true);

for (int i = 0; i < 20; i++){
float anglef = ((float)i / 19.0f) * TWO_PI;
float anglef = ((float)i / 19.0f) * glm::two_pi<float>();
float x = 340 + 30 * cos(anglef);
float y = 550 + 30 * sin(anglef);
ofVertex(x,y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class yolo5ImageClassify{
cv::Mat format_yolov5(const cv::Mat &source) {
int col = source.cols;
int row = source.rows;
int _max = MAX(col, row);
int _max = std::max(col, row);
cv::Mat result = cv::Mat::zeros(_max, _max, CV_8UC3);
source.copyTo(result(cv::Rect(0, 0, col, row)));
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void ofApp::draw(){
float deltaTime = ofClamp( ofGetLastFrameTime(), 1.f / 5000.f, 1.f / 5.f );

ofSetColor( 255 );
float scale = grayImage.getWidth() / MAX(1,currentImage.getWidth());
float scale = grayImage.getWidth() / std::max(1.f,currentImage.getWidth());

if(grayImage.bAllocated){
if( mode == MODE_SPIN_CUBES ){
Expand Down
2 changes: 1 addition & 1 deletion examples/gl/billboardRotationExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void ofApp::update() {
}

// get the 2d heading
float angle = (float)atan2(-vel[i].y, vel[i].x) + PI;
float angle = std::atan2(-vel[i].y, vel[i].x) + glm::pi<float>();
rotations[i] = (angle * -1.0);
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gl/materialPBRAdvancedExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void ofApp::renderScene(bool bShadowPass) {

matSphere.begin();
ofPushMatrix();
ofTranslate( 700.0*cos(angle-PI), -20, sin(angle-PI)*300.0-100 );
ofTranslate( 700.0 * std::cos(angle - glm::pi<float>()), -20, std::sin(angle - glm::pi<float>())*300.0-100 );
ofScale(120);
meshPlySphere.draw();
ofPopMatrix();
Expand Down
2 changes: 1 addition & 1 deletion examples/gl/multiLightExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void ofApp::update() {
sin(ofGetElapsedTimef()*.8f) * radius * 2 + center.y,
-cos(ofGetElapsedTimef()*.8f) * radius * 2 + center.z);

spotLight.setOrientation( { 0, cos(ofGetElapsedTimef()) * RAD_TO_DEG, 0 } );
spotLight.setOrientation( { 0, glm::degrees(cos(ofGetElapsedTimef())), 0 } );
spotLight.setPosition( mouseX, mouseY, 200);
}

Expand Down
Loading