@pirireis/webglobeplugins 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -147,7 +147,6 @@ export default class Plugin {
147
147
  'adaptor': (item) => new Float32Array([item.dashOpacity])
148
148
  }],
149
149
  ["circleDashAngle", {
150
-
151
150
  'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
152
151
  'adaptor': (item) => new Float32Array([item.circleDashAngle / 360])
153
152
  }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -102,22 +102,22 @@ vec3 circleLimpFromLongLatRadCenterCartesian3D( vec2 center, float radius, float
102
102
  tangent1 = normalize(tangent1);
103
103
  // rotate tangent with given angle
104
104
  tangent1 = cos(angle) * tangent1 - sin(angle) * cross(normal, tangent1);
105
- return (geoW * cos(radius/R))+ tangent1 * radius / 1000.0;
105
+ float radius_in_angle = radius/R;
106
+ float projected_radius = sin(radius_in_angle) * R / 1000.0;
107
+ return (geoW * cos(radius_in_angle))+ tangent1 * projected_radius;
106
108
  }
107
109
  `;
108
110
 
109
111
  // TODO: Make it precise. Y axis is not correct.
110
112
 
111
- // ln | tan [ (x/2) + (π/4) ] | + C
112
- export const circleLimpFromLongLatRadCenterMercatorRealDistance = `
113
+ export const circleLimpFromLongLatRadCenterMercatorRealDistance = PI + `
113
114
  vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle){
114
- float radius_radian = radius / R;
115
- float lat = center.y - radius_radian * sin(angle);
116
- float scale = 1.0/abs( cos( lat ) );
117
- float y = log( tan( PI / 4.0 + lat / 2.0 ) ) * R;
118
- vec2 center_ = longLatRadToMercator(center);
119
- float x = center_.x + scale * radius * cos(angle);
120
- return vec2(x, y);
115
+ float ang = angle + PI / 2.0; // this is there because rest of the program is in angle 0 is +x axis orientatation
116
+ float r = radius / R;
117
+ float sin_lat = sin( center.y) * cos(r) + cos(center.y)*sin(r)* cos(ang);
118
+ float lat = asin(sin_lat);
119
+ float longi = center.x + atan( sin(ang) * sin(r) * cos(center.y), cos(r) - sin(center.y) * sin_lat);
120
+ return longLatRadToMercator(vec2(longi, lat));
121
121
  }
122
122
  `;
123
123
 
@@ -206,7 +206,7 @@ export const angleBetweenTwoPointsRadian = `
206
206
  float angleBetweenTwoPointsRadian(vec2 start_, vec2 end_) {
207
207
  float start_lat = log( tan( ( 1.0 - start_.y ) * PI / 2.0 ) );
208
208
  float end_lat = log( tan( ( 1.0 - end_.y ) * PI / 2.0 ) );
209
- float angle = atan( (end_lat - start_lat )/ (end_.x - start_.x));
209
+ float angle = atan( (end_lat - start_lat ) / (end_.x - start_.x));
210
210
  return angle;
211
211
  }
212
212
  `