bugün
- oruç açı anlamak içinse açlar neden oruç tutar11
- yazılımcı erkeklerin yakışıklı olmaması7
- tefsiriyle okusak ülkenin yarısı dinden çıkar11
- kizlarsoruyor com6
- cd devrinin bitmesi16
- akp bitince ne olacak22
- kucak dansı yapmayı bilen kız sayısının azalması6
- macron koşacak diye park kapatan akepe31
- kuranı kerim meali6
- götün sürekli kanaması5
- aleti kestirip geneleve düşmek2
- royall stars4
- avm otoparkında uygunsuz çifte bağıran kadın21
- arkadaşlar yoruldum2
- çocuk istememe nedenleri5
- fusya semsiyeli yabanci17
- aşırı çıplaklığın rahatsız edici olması34
- herzevekil5
- sözlük hatunlarının nefsimi kabartması sorunsalı11
- arkadaşlar lütfen bilgi içerikli entry girelim12
- çirkin adam güzel kadın aşkı4
- erkekten ev işi bekleyen kadın2
- ben buraya yargılanmaya değil yargılamaya geldim3
- öğretmen olmak5
- no 12
- izlanda başbakanı'nın külliye'ye hayran kalması2
- 8 temmuz 2026 ekrem imamoğlu savunması4
- das kapital i yırtan kız2
- krediyle kurban kesen müslüman2
- ulu sözlük team3
- rusya'nın dizel yakıt ihracatını yasaklaması2
- bezelye yemeği9
- sikmek icin entry ni beğendi7
- aşık olunan ünlüler2
- gaddar kerim in mesleği nedir4
- akrabalarla tüm alakayı kesmek5
- güzel zannedilen kadınların sıradan olmaları9
- uzun zamandır yapmadığınız şeyler10
- araba sevdası2
- bedenen yorulmak mı beynen yorulmak mı4
- toyota corolla3
- otel odasında ölü bulunmak12
- alaçatı da hayır lokmasını talan eden teyzeler8
- ölümün en iyi tanımı17
- ekşi sözlükteki başlıkları uludağ sözlükte görmek7
- ilahi bir gücün sizi frenlediği düşüncesi7
- borç olmadan kira olmadan iyi olan para2
- kol saati takmanın anlamsızlığı15
- inte suri hur2
- ciguli kral20
yaşadığımız dünyanın simülasyon olup olmadığını sorgulatan karelere evsahipliği yapar.
(video artık mevcut değil)
#include <GL/glut.h>
#include <glm/glm.hpp>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace glm;
// Fizik sabitleri
const float G = 6.67430e-11f; // Kütleçekim sabiti
const float dt = 20.51f; // Zaman adımı
const int NUM_SPHERES = 402; // 100 rastgele küre ve 2 başlangıç küresi
// Ekran boyutları
int windowWidth = 1920;
int windowHeight = 1080;
// Küre yapısı
struct Sphere {
vec3 position;
vec3 velocity;
vec3 acceleration;
float mass;
float radius;
float angularVelocity; // Açısal hız
float spin; // Dönme açısı
vec3 color; // Renk
};
// Küre tanımları
std::vector<Sphere> spheres;
// Işık kaynağı
vec3 lightPosition = vec3(0.8f, -0.8f, 0.8f);
// Kütleçekim kuvvetini hesaplayan fonksiyon
vec3 computeGravitationalForce(Sphere& a, Sphere& b) {
vec3 direction = b.position - a.position;
float distance = length(direction);
// Kütleçekim kuvveti, mesafe sıfıra inmemeli
if (distance == 0) return vec3(0.0f);
vec3 force = G * a.mass * b.mass / (distance * distance) * normalize(direction);
return force;
}
// Güncelleme fonksiyonu
void updatePhysics() {
for (size_t i = 0; i < spheres.size(); ++i) {
spheres[i].acceleration = vec3(0.0f); // Her küre için ivmeyi sıfırla
}
// Kütleçekim kuvvetlerini hesapla
for (size_t i = 0; i < spheres.size(); ++i) {
for (size_t j = i + 1; j < spheres.size(); ++j) {
vec3 force = computeGravitationalForce(spheres[i], spheres[j]);
spheres[i].acceleration += force / spheres[i].mass;
spheres[j].acceleration -= force / spheres[j].mass; // Üzerine etki eden kuvvetin zıttı
}
}
// Hız ve konum güncellemeleri
for (Sphere& sphere : spheres) {
sphere.velocity += sphere.acceleration * dt;
sphere.position += sphere.velocity * dt;
// Ekranın dışına çıkma kontrolü
if (sphere.position.x < -1.0f - sphere.radius) {
sphere.position.x = 1.0f + sphere.radius; // Sol dışına çıktıysa sağdan gir
} else if (sphere.position.x > 1.0f + sphere.radius) {
sphere.position.x = -1.0f - sphere.radius; // Sağ dışına çıktıysa soldan gir
}
if (sphere.position.y < -1.0f - sphere.radius) {
sphere.position.y = 1.0f + sphere.radius; // Alt dışına çıktıysa üstten gir
} else if (sphere.position.y > 1.0f + sphere.radius) {
sphere.position.y = -1.0f - sphere.radius; // Üst dışına çıktıysa alttan gir
}
// Açısal dönüşü güncelle
sphere.spin += sphere.angularVelocity * dt;
}
}
// Aydınlatmayı ayarla
void setupLighting() {
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat lightPos[] = {lightPosition.x, lightPosition.y, lightPosition.z, 1.0f};
GLfloat lightColor[] = {1.0f, 1.0f, 0.8f, 1.0f}; // Sarımsı ışık
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
}
// Küreleri çizen fonksiyon
void drawSphere(const Sphere& sphere) {
glPushMatrix();
glTranslatef(sphere.position.x, sphere.position.y, sphere.position.z);
glRotatef(sphere.spin * (180.0f / M_PI), 0.0f, 0.0f, 1.0f); // Z ekseni etrafında döndür
// Renk ataması
GLfloat color[] = {sphere.color.r, sphere.color.g, sphere.color.b, 1.0f};
glMaterialfv(GL_FRONT, GL_DIFFUSE, color);
glutSolidSphere(sphere.radius, 50, 50);
glPopMatrix();
}
// Çizim fonksiyonu
void display() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
setupLighting();
// Küreleri çiz
for (const Sphere& sphere : spheres) {
drawSphere(sphere);
}
glutSwapBuffers();
}
// Ana döngü
void idle() {
updatePhysics();
glutPostRedisplay();
}
// Rastgele bir renk oluşturma fonksiyonu
vec3 randomColor() {
return vec3(static_cast<float>(rand()) / RAND_MAX, // Renk bileşeni 0.0 ile 1.0 arasında
static_cast<float>(rand()) / RAND_MAX,
static_cast<float>(rand()) / RAND_MAX);
}
// Başlangıç ayarları
void init() {
glEnable(GL_DEPTH_TEST);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
// Rastgele küreleri oluştur
std::srand(static_cast<unsigned int>(std::time(0))); // Rastgele sayı üreteci için başlangıç
for (int i = 0; i < NUM_SPHERES; ++i) {
float radius = static_cast<float>(rand() % 5 + 1) * 0.01f; // Küre yarıçapı 0.001 ile 0.08 arasında
float mass = radius * 10.0f; // Kütle, yarıçap ile orantılı
vec3 position = vec3(static_cast<float>(rand()) / RAND_MAX * 2.0f - 1.0f, // -1 ile 1 arasında rastgele pozisyon
static_cast<float>(rand()) / RAND_MAX * 2.0f - 1.0f,
0.0f);
vec3 velocity = vec3(static_cast<float>(rand()) / RAND_MAX * 0.02f - 0.01f, // -0.01 ile 0.01 arasında rastgele hız
static_cast<float>(rand()) / RAND_MAX * 0.02f - 0.01f,
0.0f);
float angularVelocity = static_cast<float>(rand()) / RAND_MAX * 2.0f - 1.0f; // Rastgele açısal hız
// Rastgele renk atama
vec3 color = randomColor();
spheres.push_back({position, velocity, vec3(0.0f), mass, radius, angularVelocity, 0.0f, color});
}
// ilk iki küreyi başlangıçta ekleyin
spheres.insert(spheres.begin(), {
{vec3(-0.5f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f), 5.0f, 0.1f, 1.0f, 0.0f, vec3(1.0f, 0.0f, 0.0f)}, // Kırmızı
{vec3(0.5f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f), 5.0f, 0.1f, -1.0f, 0.0f, vec3(0.0f, 0.0f, 1.0f)} // Mavi
});
}
// Program başlangıcı
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(windowWidth, windowHeight);
glutCreateWindow("Kütleçekim Simülasyonu");
init();
glutDisplayFunc(display);
glutIdleFunc(idle);
glutMainLoop();
return 0;
}
(video artık mevcut değil)
#include <GL/glut.h>
#include <glm/glm.hpp>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace glm;
// Fizik sabitleri
const float G = 6.67430e-11f; // Kütleçekim sabiti
const float dt = 20.51f; // Zaman adımı
const int NUM_SPHERES = 402; // 100 rastgele küre ve 2 başlangıç küresi
// Ekran boyutları
int windowWidth = 1920;
int windowHeight = 1080;
// Küre yapısı
struct Sphere {
vec3 position;
vec3 velocity;
vec3 acceleration;
float mass;
float radius;
float angularVelocity; // Açısal hız
float spin; // Dönme açısı
vec3 color; // Renk
};
// Küre tanımları
std::vector<Sphere> spheres;
// Işık kaynağı
vec3 lightPosition = vec3(0.8f, -0.8f, 0.8f);
// Kütleçekim kuvvetini hesaplayan fonksiyon
vec3 computeGravitationalForce(Sphere& a, Sphere& b) {
vec3 direction = b.position - a.position;
float distance = length(direction);
// Kütleçekim kuvveti, mesafe sıfıra inmemeli
if (distance == 0) return vec3(0.0f);
vec3 force = G * a.mass * b.mass / (distance * distance) * normalize(direction);
return force;
}
// Güncelleme fonksiyonu
void updatePhysics() {
for (size_t i = 0; i < spheres.size(); ++i) {
spheres[i].acceleration = vec3(0.0f); // Her küre için ivmeyi sıfırla
}
// Kütleçekim kuvvetlerini hesapla
for (size_t i = 0; i < spheres.size(); ++i) {
for (size_t j = i + 1; j < spheres.size(); ++j) {
vec3 force = computeGravitationalForce(spheres[i], spheres[j]);
spheres[i].acceleration += force / spheres[i].mass;
spheres[j].acceleration -= force / spheres[j].mass; // Üzerine etki eden kuvvetin zıttı
}
}
// Hız ve konum güncellemeleri
for (Sphere& sphere : spheres) {
sphere.velocity += sphere.acceleration * dt;
sphere.position += sphere.velocity * dt;
// Ekranın dışına çıkma kontrolü
if (sphere.position.x < -1.0f - sphere.radius) {
sphere.position.x = 1.0f + sphere.radius; // Sol dışına çıktıysa sağdan gir
} else if (sphere.position.x > 1.0f + sphere.radius) {
sphere.position.x = -1.0f - sphere.radius; // Sağ dışına çıktıysa soldan gir
}
if (sphere.position.y < -1.0f - sphere.radius) {
sphere.position.y = 1.0f + sphere.radius; // Alt dışına çıktıysa üstten gir
} else if (sphere.position.y > 1.0f + sphere.radius) {
sphere.position.y = -1.0f - sphere.radius; // Üst dışına çıktıysa alttan gir
}
// Açısal dönüşü güncelle
sphere.spin += sphere.angularVelocity * dt;
}
}
// Aydınlatmayı ayarla
void setupLighting() {
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat lightPos[] = {lightPosition.x, lightPosition.y, lightPosition.z, 1.0f};
GLfloat lightColor[] = {1.0f, 1.0f, 0.8f, 1.0f}; // Sarımsı ışık
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
}
// Küreleri çizen fonksiyon
void drawSphere(const Sphere& sphere) {
glPushMatrix();
glTranslatef(sphere.position.x, sphere.position.y, sphere.position.z);
glRotatef(sphere.spin * (180.0f / M_PI), 0.0f, 0.0f, 1.0f); // Z ekseni etrafında döndür
// Renk ataması
GLfloat color[] = {sphere.color.r, sphere.color.g, sphere.color.b, 1.0f};
glMaterialfv(GL_FRONT, GL_DIFFUSE, color);
glutSolidSphere(sphere.radius, 50, 50);
glPopMatrix();
}
// Çizim fonksiyonu
void display() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
setupLighting();
// Küreleri çiz
for (const Sphere& sphere : spheres) {
drawSphere(sphere);
}
glutSwapBuffers();
}
// Ana döngü
void idle() {
updatePhysics();
glutPostRedisplay();
}
// Rastgele bir renk oluşturma fonksiyonu
vec3 randomColor() {
return vec3(static_cast<float>(rand()) / RAND_MAX, // Renk bileşeni 0.0 ile 1.0 arasında
static_cast<float>(rand()) / RAND_MAX,
static_cast<float>(rand()) / RAND_MAX);
}
// Başlangıç ayarları
void init() {
glEnable(GL_DEPTH_TEST);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
// Rastgele küreleri oluştur
std::srand(static_cast<unsigned int>(std::time(0))); // Rastgele sayı üreteci için başlangıç
for (int i = 0; i < NUM_SPHERES; ++i) {
float radius = static_cast<float>(rand() % 5 + 1) * 0.01f; // Küre yarıçapı 0.001 ile 0.08 arasında
float mass = radius * 10.0f; // Kütle, yarıçap ile orantılı
vec3 position = vec3(static_cast<float>(rand()) / RAND_MAX * 2.0f - 1.0f, // -1 ile 1 arasında rastgele pozisyon
static_cast<float>(rand()) / RAND_MAX * 2.0f - 1.0f,
0.0f);
vec3 velocity = vec3(static_cast<float>(rand()) / RAND_MAX * 0.02f - 0.01f, // -0.01 ile 0.01 arasında rastgele hız
static_cast<float>(rand()) / RAND_MAX * 0.02f - 0.01f,
0.0f);
float angularVelocity = static_cast<float>(rand()) / RAND_MAX * 2.0f - 1.0f; // Rastgele açısal hız
// Rastgele renk atama
vec3 color = randomColor();
spheres.push_back({position, velocity, vec3(0.0f), mass, radius, angularVelocity, 0.0f, color});
}
// ilk iki küreyi başlangıçta ekleyin
spheres.insert(spheres.begin(), {
{vec3(-0.5f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f), 5.0f, 0.1f, 1.0f, 0.0f, vec3(1.0f, 0.0f, 0.0f)}, // Kırmızı
{vec3(0.5f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f), 5.0f, 0.1f, -1.0f, 0.0f, vec3(0.0f, 0.0f, 1.0f)} // Mavi
});
}
// Program başlangıcı
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(windowWidth, windowHeight);
glutCreateWindow("Kütleçekim Simülasyonu");
init();
glutDisplayFunc(display);
glutIdleFunc(idle);
glutMainLoop();
return 0;
}
Gündemdeki Haberler
Güncel Önemli Başlıklar