Anfängerfragen zum Programmieren mit PureBasic.
-
Andreas_S
- Beiträge: 787
- Registriert: 14.04.2007 16:48
- Wohnort: Wien Umgebung
-
Kontaktdaten:
Beitrag
von Andreas_S »
Ich denke x1,y1,z1 sin die ursprungs variablen und der underline ist deswegen weil er wohl eine eigene procedure für sin und cos hat:
Code: Alles auswählen
Procedure.d _sin(Angle.d)
ProcedureReturn Sin((Angle*#PI)/180)
EndProcedure
Procedure.d _cos(Angle.d)
ProcedureReturn Cos((Angle*#PI)/180)
EndProcedure
@Deeem2031
Ich verwend mal diese gleichungen... danke
Andreas
-
Scarabol
- Beiträge: 1427
- Registriert: 30.11.2005 21:00
Beitrag
von Scarabol »
Funktionierts?
Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch:
PureArea
PB-V: 4
WinXP
-
Scarabol
- Beiträge: 1427
- Registriert: 30.11.2005 21:00
Beitrag
von Scarabol »
Darf man mal fragen woran du gerade arbeitest?
Wenns ne kleine Grafikdemo ist, was benutzt du zum anzeigen und transformen der Sprites?
Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch:
PureArea
PB-V: 4
WinXP
-
Andreas_S
- Beiträge: 787
- Registriert: 14.04.2007 16:48
- Wohnort: Wien Umgebung
-
Kontaktdaten:
Beitrag
von Andreas_S »
Mich interessiert die Mathematik der 3 dimensionalität und ich schreibe gerade in java ein art renderer.
die "sprites" transormiere ich selbst und lines und so werden auch selbst berechnet.
Andreas
-
Scarabol
- Beiträge: 1427
- Registriert: 30.11.2005 21:00
Beitrag
von Scarabol »
Nice
Vielleicht sehn wir ja bald hier mal was unter Andere Sprachen....
Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch:
PureArea
PB-V: 4
WinXP
-
Scarabol
- Beiträge: 1427
- Registriert: 30.11.2005 21:00
Beitrag
von Scarabol »
Bei mir funktionierts irgendwie nicht.....
x = links/rechts
y = oben/unten
z = vorne/hinten
oder?
Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch:
PureArea
PB-V: 4
WinXP
-
Andreas_S
- Beiträge: 787
- Registriert: 14.04.2007 16:48
- Wohnort: Wien Umgebung
-
Kontaktdaten:
Beitrag
von Andreas_S »
nicht ganz...
x1 entspricht abstand von der x achse
y1 das gleiche y achse
z1 für z achse
also musste du einen rotations mittelpunkt angeben...
ich geb dir mal meinen java code:
Code: Alles auswählen
public static V3D calcRotation(V3D point,V3D rotatePoint,V3D rotateAngle) {
V3D result = new V3D();
V3D d = new V3D();
d.x = point.x - rotatePoint.x;
d.y = point.y - rotatePoint.y;
d.z = point.z - rotatePoint.z;
// X + Y + Z Rotation
// Internet
result.x = rotatePoint.x + cos(rotateAngle.y) * cos(rotateAngle.z) * d.x - cos(rotateAngle.y) * sin(rotateAngle.z) * d.y + sin(rotateAngle.y) * d.z;
result.y = rotatePoint.y + (cos(rotateAngle.x) * sin(rotateAngle.z) + sin(rotateAngle.x) * sin(rotateAngle.y) * cos(rotateAngle.z)) * d.x + (cos(rotateAngle.x) * cos(rotateAngle.z) - sin(rotateAngle.x) * sin(rotateAngle.y) * sin(rotateAngle.z)) * d.y - sin(rotateAngle.x) * cos(rotateAngle.y) * d.z;
result.z = rotatePoint.z + (sin(rotateAngle.x) * sin(rotateAngle.z) - cos(rotateAngle.x) * sin(rotateAngle.y) * cos(rotateAngle.z)) * d.x + (sin(rotateAngle.x) * cos(rotateAngle.z) + cos(rotateAngle.x) * sin(rotateAngle.y) * sin(rotateAngle.z)) * d.y + cos(rotateAngle.x) * cos(rotateAngle.y) * d.z;
// X Rotation
/*result.x = point.x;
result.y = rotatePoint.y + (cos(rotateAngle.x) * d.y - sin(rotateAngle.x) * d.z);
result.z = rotatePoint.z + (sin(rotateAngle.x) * d.y + cos(rotateAngle.x) * d.z);*/
// Y Rotation
/*result.x = rotatePoint.x + (cos(rotateAngle.y) * d.x - sin(rotateAngle.y) * d.z);
result.y = point.y;
result.z = rotatePoint.z + (sin(rotateAngle.y) * d.x + cos(rotateAngle.y) * d.z);*/
// Z Rotation
/*result.x = rotatePoint.x + (cos(rotateAngle.z) * d.x - sin(rotateAngle.z) * d.y);
result.y = rotatePoint.y + (sin(rotateAngle.z) * d.x + cos(rotateAngle.z) * d.y);
result.z = point.z;*/
return result;
}
d.* entspricht dann dem "neuen null-punkt" abstand
viel spaß, Andreas
-
Scarabol
- Beiträge: 1427
- Registriert: 30.11.2005 21:00
Beitrag
von Scarabol »
Ok Danke,
dachte erst das der Punkt um den Ursprung des Koordinatensystems gedreht wird....
Gruß
Scarabol
Abgeschlossen Projekte:
Schreibmaschine, Bildschirmlupe, Wings3DtoOgreMeshConverter
Watch:
PureArea
PB-V: 4
WinXP
-
Andreas_S
- Beiträge: 787
- Registriert: 14.04.2007 16:48
- Wohnort: Wien Umgebung
-
Kontaktdaten:
Beitrag
von Andreas_S »
Mein Mathematiklehrer hat mir gezeigt wie man das lösen kann
Ich stell vil. heite noch den Lösungsvorgang rauf...
Bis dann, Andreas