לקובץ המקורי(1,000 × 1,360 פיקסלים, גודל הקובץ: 972 ק"ב, סוג MIME‏: image/png)

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

תקציר

תיאור
English: Stereographic projection of 6-4 Duopyramid (blu) with its dual Duoprism (phantom red). In the last row, the Duopyramid is projected by a direction perpendicular to the first one; so the two parameters (6,4) seem to be reversed. Indeed, asymmetry is due to the projection: the two parameters are symmetric in 4D.
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
יוצר Claudio Rocchini

רישיון

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

Source Code

The source code needs some implementation of point3 and point4.

/* Duopyramid VRML generator
 * (C) 2012-2013 CC-By 3.0 Claudio Rocchini
 */
 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "point3.h"
#include "point4.h"

const double PI = 3.1415926535897932384626433832795;
const double S = 100;
const double K1 = 0.03;
const double K2 = 0.06;
	
static void draw_sphere( FILE * fo, const point3 & p, double r ) {
	fprintf(fo,
		"Separator{\n"
		"\tTranslation { translation %g %g %g }\n"
		"\tSphere { radius %g }\n"
		"}\n"
		,p.x*S,p.y*S,p.z*S,r*S
	);
}
		
static void draw_edge( FILE * fo, const point3 & p1, double r1, const point3 & p2, double r2 ) {
	point3 d = p2-p1; double l = lenght(d); normalize(d);
	point3 c = (p1+p2)/2.0;
	point3 Y(0,1,0);
	point3 rd = d^Y; normalize(rd); double ra = -acos(d*Y);
	double r = (r1+r2)/2;
	
	fprintf(fo,
		"Separator{\n"
		"\tTranslation { translation %g %g %g }\n"
		"\t\tRotation { rotation %g %g %g %g }\n"
		"\t\tCylinder {\n\t\tparts SIDES\n"
        "\t\tradius %g\n\t\theight %g\n"
		"\t}\n}\n"
		,c.x*S,c.y*S,c.z*S
		,rd.x,rd.y,rd.z,ra
		,r*S,l*S
	);
}

void rotate( point4 & p ) {
	double theta = PI/2; double cs = cos(theta); double sn = sin(theta);
	double z = p.y;
	double v = p.v;
	p.y = z * cs - v * sn;
	p.v = z * sn + v * cs;
}

void proj( const point4 & v, point3 & w, double & R ) {
	w.x = v.x / (2-v.v); w.y = v.y / (2-v.v);
	w.z = v.z / (2-v.v); R = 1.0 / (2-v.v);
}

int main() {
	const int P = 6;
	const int Q = 4;
	int i,j;
	
	const int NV = P*Q; point4 V[NV];
	for(i=0;i<P;++i) {
		double ai = i*2*PI/P;
		for(j=0;j<Q;++j) {
			double aj = j*2*PI/Q;
			V[i*Q+j].x = cos(ai); V[i*Q+j].y = sin(ai);
			V[i*Q+j].z = cos(aj); V[i*Q+j].v = sin(aj);
		}
	}
	
	const int NV2 = P+Q; point4 V2[NV2];
	for(i=0;i<P;++i) {
		double a1 = i*2*PI/P;         double x1 = cos(a1); double y1 = sin(a1);
		double a2 = ((i+1)%P)*2*PI/P; double x2 = cos(a2); double y2 = sin(a2);
		V2[i+0].x = (x1+x2)/2; V2[i+0].z = 0;
		V2[i+0].y = (y1+y2)/2; V2[i+0].v = 0;
	}
	for(j=0;j<Q;++j) {
		double a1 = j*2*PI/Q;         double z1 = cos(a1); double v1 = sin(a1);
		double a2 = ((j+1)%Q)*2*PI/Q; double z2 = cos(a2); double v2 = sin(a2);
		V2[j+P].x = 0; V2[j+P].z = (z1+z2)/2;
		V2[j+P].y = 0; V2[j+P].v = (v1+v2)/2;
	}
	
	point3 VP[NV]; double R[NV];
	point3 VP2[NV2]; double R2[NV2];
	for(i=0;i<NV;++i) {
		rotate(V[i]); proj(V[i],VP[i],R[i]);
	}
	for(i=0;i<NV2;++i) {
		rotate(V2[i]); proj(V2[i],VP2[i],R2[i]);
	}

	FILE * fo = fopen("duppyramid.wrl","w");	
	fprintf(fo, "#VRML V1.0 ascii\n" );
	
	fprintf(fo,
		"Material {\n"
        "\tdiffuseColor [0.4 0.1 0.0]\n"
        "\tspecularColor [0.7 0.7 0.7]\n"
        "\temissiveColor[]\n"
        "\tambientColor[0.4 0.4 0.4]\n"
        "\tshininess 0.16\n"
        "\ttransparency 0.5\n"
		"}\n"
	);
 
	for(i=0;i<NV;++i)
		draw_sphere(fo,VP[i],R[i]*K2);
	for(j=0;j<Q;++j)
		for(i=0;i<P;++i) {
			draw_edge(fo,VP[i*Q+j],R[i*Q+j]*K1,VP[((i+1)%P)*Q+j],R[((i+1)%P)*Q+j]*K1);
			draw_edge(fo,VP[i*Q+j],R[i*Q+j]*K1,VP[i*Q+(j+1)%Q],R[i*Q+(j+1)%Q]*K1);
		}

	fprintf(fo,
		"Material {\n"
        "\tdiffuseColor [0.1 0.2 0.5]\n"
        "\tspecularColor [0.7 0.7 0.7]\n"
        "\temissiveColor[]\n"
        "\tambientColor[0.4 0.4 0.4]\n"
        "\tshininess 0.16\n"
        "\ttransparency 0.0\n"
		"}\n"
	);
 
	for(i=0;i<NV2;++i)
		draw_sphere(fo,VP2[i],R2[i]*K2);

	for(i=0;i<P;++i)
		draw_edge(fo,VP2[i],R2[i]*K1,VP2[(i+1)%P],R2[(i+1)%P]*K1);
	for(j=0;j<Q;++j)
		draw_edge(fo,VP2[P+j],R2[P+j]*K1,VP2[P+(j+1)%Q],R2[P+(j+1)%Q]*K1);
	for(i=0;i<P;++i)
	for(j=0;j<Q;++j)
		draw_edge(fo,VP2[0+i],R2[0+i]*K1,VP2[P+j],R2[P+j]*K1);

	fclose(fo);
	
	return 0;
}

כיתובים

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

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

מוצג

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

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

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית17:54, 14 בדצמבר 2012תמונה ממוזערת לגרסה מ־17:54, 14 בדצמבר 2012‪1,360 × 1,000‬ (972 ק"ב)RocchiniUser created page with UploadWizard

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

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

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