mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-31 22:12:59 +00:00
advanced Hypersian Rug (no options yet)
This commit is contained in:
@@ -82,6 +82,10 @@ ld intvalxy(const hyperpoint &h1, const hyperpoint &h2) {
|
||||
return squar(h1[0]-h2[0]) + squar(h1[1]-h2[1]);
|
||||
}
|
||||
|
||||
ld intvalxyz(const hyperpoint &h1, const hyperpoint &h2) {
|
||||
return squar(h1[0]-h2[0]) + squar(h1[1]-h2[1]) + squar(h1[2]-h2[2]);
|
||||
}
|
||||
|
||||
ld zlevel(const hyperpoint &h) {
|
||||
if(euclid) return h[2];
|
||||
else if(sphere) return sqrt(intval(h, Hypc));
|
||||
@@ -390,15 +394,15 @@ double hdist(const hyperpoint& h1, const hyperpoint& h2) {
|
||||
|
||||
namespace hyperpoint_vec {
|
||||
|
||||
hyperpoint operator * (double d, hyperpoint h) {
|
||||
hyperpoint operator * (ld d, hyperpoint h) {
|
||||
return hpxyz(h[0]*d, h[1]*d, h[2]*d);
|
||||
}
|
||||
|
||||
hyperpoint operator * (hyperpoint h, double d) {
|
||||
hyperpoint operator * (hyperpoint h, ld d) {
|
||||
return hpxyz(h[0]*d, h[1]*d, h[2]*d);
|
||||
}
|
||||
|
||||
hyperpoint operator / (hyperpoint h, double d) {
|
||||
hyperpoint operator / (hyperpoint h, ld d) {
|
||||
return hpxyz(h[0]/d, h[1]/d, h[2]/d);
|
||||
}
|
||||
|
||||
@@ -409,7 +413,20 @@ namespace hyperpoint_vec {
|
||||
hyperpoint operator - (hyperpoint h, hyperpoint h2) {
|
||||
return hpxyz(h[0]-h2[0], h[1]-h2[1], h[2]-h2[2]);
|
||||
}
|
||||
|
||||
|
||||
// cross product
|
||||
hyperpoint operator ^ (hyperpoint h1, hyperpoint h2) {
|
||||
return hpxyz(
|
||||
h1[1] * h2[2] - h1[2] * h2[1],
|
||||
h1[2] * h2[0] - h1[0] * h2[2],
|
||||
h1[0] * h2[1] - h1[1] * h2[0]
|
||||
);
|
||||
}
|
||||
|
||||
// inner product
|
||||
ld operator | (hyperpoint h1, hyperpoint h2) {
|
||||
return h1[0] * h2[0] + h1[1] * h2[1] + h1[2] * h2[2];
|
||||
}
|
||||
}
|
||||
|
||||
hyperpoint mscale(const hyperpoint& t, double fac) {
|
||||
|
||||
Reference in New Issue
Block a user