לדלג לתוכן

קובץ:Particle2dmotion.svg

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיפדיה, האנציקלופדיה החופשית

לקובץ המקורי(קובץ SVG, הגודל המקורי: 1,600 × 1,000 פיקסלים, גודל הקובץ: 1.74 מ"ב)

ויקישיתוף זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה.

תקציר

תיאור
English: Belief distributions for a non-sensing robot after moving for several steps in two dimensions. The diagram was generated using the following c++ code, hereby licensed under the same license as the diagram itself:
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <fstream>
#include <sstream>
using namespace std;

const int M = 2000;

const long double
    ANGLE_NOISE = 0.04,
    ANGLE_P_NOISE = 0.0002,
    ANGLE_R_NOISE = 0.02,
    R_NOISE = 3,
    R_P_NOISE = 0.008,
    PI = 3.1415926535897932384626433832795028;

struct particle {
    long double x, y;
    long double theta;
};

vector<particle>z;
particle qwer;

fstream fout("particle2d.svg", fstream::out);
ostringstream poly;

inline long double noise() {
    return (rand()/(long double)RAND_MAX) - (rand()/(long double)RAND_MAX) + (rand()/(long double)RAND_MAX) - (rand()/(long double)RAND_MAX);
}

void move(long double r, long double t) {
    qwer.theta += t;
    qwer.x += r*cos(qwer.theta);
    qwer.y += r*sin(qwer.theta);
    for(int i=0; i<M; i++) {
        z[i].theta += t + r*ANGLE_P_NOISE*noise() + ANGLE_NOISE*noise() + t*ANGLE_R_NOISE*noise();
        z[i].x += r*cos(z[i].theta) + R_NOISE*noise() + r*R_P_NOISE*noise();
        z[i].y += r*sin(z[i].theta) + R_NOISE*noise() + r*R_P_NOISE*noise();
        fout << "   <circle cx='" << z[i].x << "' cy='" << z[i].y << "' r='1' style='fill:#000;opacity:0.8;'/>" << endl;
    }
    fout << "   <circle cx='" << qwer.x << "' cy='" << qwer.y << "' r='6' style='fill:#f30;'/>" << endl;
    fout << "   <path d='M" << qwer.x - r/2.4*cos(qwer.theta) << "," << qwer.y - r/2.4*sin(qwer.theta) 
         << "L" << qwer.x - r/2*cos(qwer.theta - 0.05) << "," << qwer.y - r/2*sin(qwer.theta - 0.05) 
         << "L" << qwer.x - r/2*cos(qwer.theta + 0.05) << "," << qwer.y - r/2*sin(qwer.theta + 0.05) << "' style='fill:#f30;'/>" << endl;
    poly << qwer.x << ',' << qwer.y << ' ';
}

int main() {
    particle start;
    start.x = 800;
    start.y = 100;
    start.theta = 0;
    qwer = start;
    for(int i=0; i<M; i++) {
        z.push_back(start);
    }
    fout << "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='1600px' height='1000px'>" << endl;
    fout << "   <circle cx='" << qwer.x << "' cy='" << qwer.y << "' r='5' style='fill:#f30;'/>" << endl;
    poly << qwer.x << ',' << qwer.y << ' ';
    move(200, 0);
    move(200, 0);
    move(200, 0);
    move(200, PI/2);
    move(200, 0);
    move(200, 0);
    move(200, PI/2);
    move(200, 0);
    move(200, 0);
    move(200, 0);
    move(200, 0);
    move(200, 0);
    fout << "<polyline points='" << poly.str() << "' style='fill:none;stroke:#f30;stroke-width:2px' />" << endl;
    fout << "</svg>" << endl;
    fout.close();
}
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
יוצר Daniel Lu

רישיון

אני, בעל זכויות היוצרים על עבודה זו, מפרסם בזאת את העבודה תחת הרישיון הבא:
w:he:Creative Commons
ייחוס שיתוף זהה
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס-שיתוף זהה 3.0 לא מותאם.
הנכם רשאים:
  • לשתף – להעתיק, להפיץ ולהעביר את העבודה
  • לערבב בין עבודות – להתאים את העבודה
תחת התנאים הבאים:
  • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
  • שיתוף זהה – אם תיצרו רמיקס, תשנו, או תבנו על החומר, חובה עליכם להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג

פריטים שמוצגים בקובץ הזה

מוצג

היסטוריית הקובץ

ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית10:57, 25 במרץ 2013תמונה ממוזערת לגרסה מ־10:57, 25 במרץ 2013‪1,000 × 1,600‬ (1.74 מ"ב)DlluUser created page with UploadWizard

אין בוויקיפדיה דפים המשתמשים בקובץ זה.

שימוש גלובלי בקובץ

אתרי הוויקי השונים הבאים משתמשים בקובץ זה:

מטא־נתונים