Submit Search
Upload
Simple particle class in OF
•
0 likes
•
231 views
AI-enhanced title
Wataru Kani
Follow
第三回 冬のスイッチ大勉強会 - Particle編 -
Read less
Read more
Education
Report
Share
Report
Share
1 of 7
Download now
Download to read offline
Recommended
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started
Teerawat Issariyakul
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
Teerawat Issariyakul
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
Yuichi Sakuraba
Data structure programs in c++
Data structure programs in c++
mmirfan
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with Groovy
Iván López Martín
AST Transformations at JFokus
AST Transformations at JFokus
HamletDRC
Ast transformations
Ast transformations
HamletDRC
AST Transformations
AST Transformations
HamletDRC
Recommended
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started
Teerawat Issariyakul
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
Teerawat Issariyakul
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
Yuichi Sakuraba
Data structure programs in c++
Data structure programs in c++
mmirfan
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with Groovy
Iván López Martín
AST Transformations at JFokus
AST Transformations at JFokus
HamletDRC
Ast transformations
Ast transformations
HamletDRC
AST Transformations
AST Transformations
HamletDRC
"Delegates, Delegates everywhere" Владимир Миронов
"Delegates, Delegates everywhere" Владимир Миронов
AvitoTech
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
Mahmoud Samir Fayed
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
Howard Lewis Ship
"Kotlin и rx в android" Дмитрий Воронин (Avito)
"Kotlin и rx в android" Дмитрий Воронин (Avito)
AvitoTech
Virtual machine and javascript engine
Virtual machine and javascript engine
Duoyi Wu
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
Stas Rivkin
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 30 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
Mahmoud Samir Fayed
JJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84
Mahmoud Samir Fayed
Greach, GroovyFx Workshop
Greach, GroovyFx Workshop
Dierk König
The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.6 book - Part 27 of 189
The Ring programming language version 1.6 book - Part 27 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
Mahmoud Samir Fayed
Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and Pindah
Nick Plante
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210
Mahmoud Samir Fayed
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
Sages
Kisah ashaabul ukhdud
Kisah ashaabul ukhdud
Noorfiazah Abdullah
Il Manifesto dei Numeri 1 italiani
Il Manifesto dei Numeri 1 italiani
Alfredo Romeo
More Related Content
What's hot
"Delegates, Delegates everywhere" Владимир Миронов
"Delegates, Delegates everywhere" Владимир Миронов
AvitoTech
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
Mahmoud Samir Fayed
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
Howard Lewis Ship
"Kotlin и rx в android" Дмитрий Воронин (Avito)
"Kotlin и rx в android" Дмитрий Воронин (Avito)
AvitoTech
Virtual machine and javascript engine
Virtual machine and javascript engine
Duoyi Wu
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
Stas Rivkin
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 30 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
Mahmoud Samir Fayed
JJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84
Mahmoud Samir Fayed
Greach, GroovyFx Workshop
Greach, GroovyFx Workshop
Dierk König
The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.6 book - Part 27 of 189
The Ring programming language version 1.6 book - Part 27 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
Mahmoud Samir Fayed
Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and Pindah
Nick Plante
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210
Mahmoud Samir Fayed
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
Sages
What's hot
(20)
"Delegates, Delegates everywhere" Владимир Миронов
"Delegates, Delegates everywhere" Владимир Миронов
The Ring programming language version 1.2 book - Part 22 of 84
The Ring programming language version 1.2 book - Part 22 of 84
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
"Kotlin и rx в android" Дмитрий Воронин (Avito)
"Kotlin и rx в android" Дмитрий Воронин (Avito)
Virtual machine and javascript engine
Virtual machine and javascript engine
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
JJUG CCC 2011 Spring
JJUG CCC 2011 Spring
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84
Greach, GroovyFx Workshop
Greach, GroovyFx Workshop
The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.6 book - Part 27 of 189
The Ring programming language version 1.6 book - Part 27 of 189
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and Pindah
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
Viewers also liked
Kisah ashaabul ukhdud
Kisah ashaabul ukhdud
Noorfiazah Abdullah
Il Manifesto dei Numeri 1 italiani
Il Manifesto dei Numeri 1 italiani
Alfredo Romeo
Fun findings on Google Earth
Fun findings on Google Earth
isantos4
Join the music revolution!
Join the music revolution!
beatvyne
MY RECHARGE PPT MAY PDF
MY RECHARGE PPT MAY PDF
rama kanth
La rumeur
La rumeur
Alizée Le Guyader
Kisah maryam puteri imran
Kisah maryam puteri imran
Noorfiazah Abdullah
Αριστοτέλης, Ηθικά Νικομάχεια
Αριστοτέλης, Ηθικά Νικομάχεια
gina zaza
Viewers also liked
(8)
Kisah ashaabul ukhdud
Kisah ashaabul ukhdud
Il Manifesto dei Numeri 1 italiani
Il Manifesto dei Numeri 1 italiani
Fun findings on Google Earth
Fun findings on Google Earth
Join the music revolution!
Join the music revolution!
MY RECHARGE PPT MAY PDF
MY RECHARGE PPT MAY PDF
La rumeur
La rumeur
Kisah maryam puteri imran
Kisah maryam puteri imran
Αριστοτέλης, Ηθικά Νικομάχεια
Αριστοτέλης, Ηθικά Νικομάχεια
Similar to Simple particle class in OF
please help me with two partI Bold it out as wrong part which in t.pdf
please help me with two partI Bold it out as wrong part which in t.pdf
RBMADU
Myraytracer
Myraytracer
kedar nath
The Future of JVM Languages
The Future of JVM Languages
VictorSzoltysek
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in Swift
Giordano Scalzo
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code Generation
Ivan Dolgushin
Advance features of C++
Advance features of C++
vidyamittal
Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01
Getachew Ganfur
oop objects_classes
oop objects_classes
sidra tauseef
The Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 Seasons
Baruch Sadogursky
JavaFX Your Way - Devoxx Version
JavaFX Your Way - Devoxx Version
Stephen Chin
package chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdf
KARTIKINDIA
Box2D with SIMD in JavaScript
Box2D with SIMD in JavaScript
Intel® Software
3433 Ch09 Ppt
3433 Ch09 Ppt
martha leon
Csphtp1 09
Csphtp1 09
HUST
Machine-level Composition of Modularized Crosscutting Concerns
Machine-level Composition of Modularized Crosscutting Concerns
saintiss
A topology of memory leaks on the JVM
A topology of memory leaks on the JVM
Rafael Winterhalter
Java byte code in practice
Java byte code in practice
Rafael Winterhalter
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
gekiaruj
JDD 2016 - Pawel Byszewski - Kotlin, why?
JDD 2016 - Pawel Byszewski - Kotlin, why?
PROIDEA
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
arjuncorner565
Similar to Simple particle class in OF
(20)
please help me with two partI Bold it out as wrong part which in t.pdf
please help me with two partI Bold it out as wrong part which in t.pdf
Myraytracer
Myraytracer
The Future of JVM Languages
The Future of JVM Languages
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in Swift
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code Generation
Advance features of C++
Advance features of C++
Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01
oop objects_classes
oop objects_classes
The Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 Seasons
JavaFX Your Way - Devoxx Version
JavaFX Your Way - Devoxx Version
package chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdf
Box2D with SIMD in JavaScript
Box2D with SIMD in JavaScript
3433 Ch09 Ppt
3433 Ch09 Ppt
Csphtp1 09
Csphtp1 09
Machine-level Composition of Modularized Crosscutting Concerns
Machine-level Composition of Modularized Crosscutting Concerns
A topology of memory leaks on the JVM
A topology of memory leaks on the JVM
Java byte code in practice
Java byte code in practice
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
JDD 2016 - Pawel Byszewski - Kotlin, why?
JDD 2016 - Pawel Byszewski - Kotlin, why?
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Recently uploaded
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
Marc Dusseiller Dusjagr
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
NirmalaLoungPoorunde1
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Thiyagu K
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
RKavithamani
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
JemimahLaneBuaron
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
chloefrazer622
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
ssuser54595a
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
Thiyagu K
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
dawncurless
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
Maksud Ahmed
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology ( Production , Purification , and Application )
Sakshi Ghasle
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Sarwono Sutikno, Dr.Eng.,CISA,CISSP,CISM,CSX-F
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
EduSkills OECD
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
RAM LAL ANAND COLLEGE, DELHI UNIVERSITY.
Recently uploaded
(20)
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology ( Production , Purification , and Application )
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
Simple particle class in OF
1.
Switch_lecture Simple particle
2.
Create class ( Xcode
) “src” -> control + click New File... Select “C++ File” & Next Set name “particle” & Next Create
3.
Simple particle ( 0,
0 ) y x position ( ofVec2f ) velocity ( ofVec2f ) radius ( float ) color( ofColor ) lifeSpan( float ) dead( bool )
4.
Structure of class Particle() ~Particle() set******() get******() Constructor Call
when creating object Call when deleting object Set property Get property Destructor Setter Getter position private public Property Method Particle() setPosition() getPosition() ~Particle() velocity radius color lifeSpan dead
5.
Class ( openFrameworks ) Property
Setter & Getter ofVec2f position ofVec2f velocity float radius ofColor color bool dead ofApp ofVec2f ofVec2f ofVec2f ofVec2f float float ofColor ofColor bool void setPosition( ofVec2f _p ) ofVec2f getPosition() void setVelocity( ofVec2f _v ) ofVec2f getVelocity() void setRadius( float _r ) float getRadius() void setColor( float _c ) ofColor getColor() bool isDead()
6.
Simple particle class (
openFrameworks ) particle.h Property Constructor Destructor Setter Getter particle.cpp #include "ofMain.h" class Particle { private: ofVec2f pos; ofVec2f vel; float radius; ofColor color; float lifeSpan; bool dead; public: Particle(); ~Particle(); void setPosition( ofVec2f _p ); void setVelocity( ofVec2f _v ); void setRadius( float _r ); void setColor( ofColor _c ); ofVec2f getPosition(); ofVec2f getVelocity(); float getRadius(); ofColor getColor(); bool isDead(); void update(); void draw(); }; #include “particle.h” Particle::Particle() { pos.set( 0, 0 ); float angle = ofRandom( TWO_PI ); vel.set( cos( angle ), sin( angle ) ); radius = ofRandom( 1, 6 ); color.set( 0, 0, 0 ); lifeSpan = ofGetElapsedTimef() + ofRandom( 2, 4 ); dead = false; } Particle::~Particle(){} void Particle::setPosition( ofVec2f _p ){ pos = _p; } void Particle::setVelocity( ofVec2f _v ){ vel = _v; } void Particle::setRadius( float _r ){ radius = _r; } void Particle::setColor( ofColor _c ){ color = _c; } ofVec2f Particle::getPosition(){ return pos; } ofVec2f Particle::getVelocity(){ return vel; } float Particle::getRadius(){ return radius; } ofColor Particle::getColor(){ return color; } bool Particle::isDead(){ return dead; } void Particle::update() { pos += vel; if( ofGetElapsedTimef() > lifeSpan ) dead = true; } void Particle::draw() { ofSetColor( color ); ofFill(); ofCircle( pos, radius ); } Constructor Setter Getter Destructor
7.
Simple particle class (
openFrameworks ) Update & Delete particles Draw particles Add particles ofApp.h ofApp.cpp #include "ofMain.h" #include "particle.h" class ofApp : public ofBaseApp { public: void setup(); void update(); void draw(); void mouseDragged( int x, int y, int button ); vector< Particle > particles; }; void ofApp::setup() { ofBackground( 255 ); } void ofApp::update() { for( vector< Particle >::iterator itr = particles.begin(); itr != particles.end(); ) { ( *itr ).update(); if( ( *itr ).isDead() ) particles.erase( itr ); else ++itr; } } void ofApp::draw() { for( int i = 0; i < particles.size(); ++i ) particles.at( i ).draw(); } void ofApp::mouseDragged( int x, int y, int button ) { Particle p; p.setPosition( ofVec2f( x, y ) ); particles.push_back( p ); }
Download now