## How to align two ellipsoids along center and long axes?

I’m struggling to understand rotation/translation transforms as applied to things like spheres and ellipsoids. Take the following silly example.

Given this pair of random ellipsoids, how do I find a rotation/translation that aligns their centers and their long axes? (no matter that they differ in sizes, only care about their centers and long axes being aligned). Are the two possible geometric transformations equivalent? (Say, moving ellipsoid 1 to be aligned to the fixed ellipsoid 2, and vice versa?)

``SeedRandom; twoRandomEllipsoids =    Table[{Ellipsoid[RandomReal[10, {3}], RandomReal[{1, 2}, 3]]}, {2}]; Graphics3D[{Opacity[0.2], twoRandomEllipsoids}, Axes -> True,   AxesLabel -> {x, y, z}] `` Thanks!

## How can I rotate the two endpoints of a line around the line’s center in 3d?

The object is a capsule. I have the position of the object vector3, and the orientation of the object, a quaternion. I want to construct a line which goes through the middle of the capsule with the two endpoints of the line being the top and bottom.

The capsule can be rotated in all 3 dimensions.

## Is the scale of a hex map measured along the edges of the map or across the center?

Various official sources include hex maps with scales on them: the Sword Coast from Dragon of Icespire Peak says "1 hex = 5 miles." Is that 5 miles measured across the center of each hex, or an edge length? I can’t seem to find any clarification in the DMG or otherwise.

## Unity: How can I find the center position of a particular triangle?

I need to face an object from a central point directly through any one of many triangles which are faces on an icosphere whose position is centered on that point. Is there a way to get the center position of the triangle itself, even though its position is the position of the larger object of which it is a part?

Posted on Categories Free Proxy

## 2d gravity simulator – smaller object orbiting towards center of bigger object

In my libgdx test game, I have initially created 2 circle objects (stellar) about which I will say more in details below. However, my goal is to simulate gravity in 2d, where smaller object orbits towards center of bigger object (just like earth orbits sun) but closer and closer to the center of bigger.

So, I have created the following:

• stellar1: smaller, 10px radius, 10 mass, dynamic (can move), initial position -160×90, velocity (0,0), accelerator (0,0)
• stellar2: bigger, 30px radius, 30 mass, static (cannot move), initial position 0x0, velocity (0,0), accelerator (0,0)

Here is also a screenshot, just to have a picture: I will give the full code below of what I did so far, before that I want to mention I have 2 approaches, StellarTest1 and StellarTest2.

First StellarTest1, I’ve tried to add some extra values like 1000f to both x and y just to see something in action like:

``velocity.x += 1000f * acceleration.x * deltaTime; velocity.y += 1000f * acceleration.x * deltaTime; ``

Resulting in – smaller object gets towards the center of the bigger object, but once it reaches the center of bigger, the smaller object gets evicted to the opposite side. Not to mention how 1000f is not the correct value in the size of this coordinate system, but I am concerned about following computation:

``acceleration.x = gravityForce * (diffX / distance) acceleration.y = gravityForce * (diffY / distance) ``

Code StellarTest1:

``public class StellarTest1 extends AbstractTest {      private Stellar stellar2, stellar1;      public StellarTest1(Game game) {         super(game);     }      @Override     public void create() {         game.getCartesianGrid().setEnabled(true);          // smaller  stellar         float startX = -160;         float startY = 90;         float radius = 10;         float mass = 10;         stellar1 = new Stellar(                 startX, startY,                 radius, mass,                 new Color(102, 188, 217, 100f)         );          // bigger stellar         startX = 0;         startY = 0;         radius = 30;         mass = 30;         stellar2 = new Stellar(                 startX, startY,                 radius, mass,                 new Color(252, 236, 3, 100f)         );         stellar2.updatable = false; // bigger object will not update, in other words no motion          stellar2.setOther(stellar1);         stellar1.setOther(stellar2);     }      @Override     public void update(float deltaTime) {         if (!updatable) {             return;         }         stellar2.update(deltaTime);         stellar1.update(deltaTime);     }      @Override     public void draw() {         if (!drawable) {             return;         }         stellar2.draw();         stellar1.draw();     }      private class Stellar {          Circle circle;         Vector2 velocity;         Vector2 direction;         Vector2 acceleration;         float mass, radius;         boolean updatable;         Stellar other;          public Stellar(                 float startX, float startY,                 float radius, float mass,                 Color color) {             this.radius = radius;             this.velocity = new Vector2(0, 0);             this.acceleration = new Vector2(0, 0);             this.mass = mass;             this.radius = radius;              circle = new Circle(game,                     color,                     startX, startY,                     radius);              this.updatable = true;         }          public void update(float deltaTime) {             if (!updatable) {                 return;             }             float diffX = other.circle.x - circle.x;             float diffY = other.circle.y - circle.y;              float G = 2f;             float mass = G * (other.mass - this.mass);             float distance = (float) Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2));             float gravityForce = (float) (mass / Math.pow(distance, 2));              acceleration.x = gravityForce * (diffX / distance);             acceleration.y = gravityForce * (diffY / distance);              velocity.x += 1000f * acceleration.x * deltaTime;             velocity.y += 1000f * acceleration.y * deltaTime;              circle.x += velocity.x * deltaTime;             circle.y += velocity.y * deltaTime;         }          public void draw() {             game.getShapeRenderer().begin(ShapeRenderer.ShapeType.Filled);             circle.draw();             game.getShapeRenderer().end();         }          public void setOther(Stellar other) {             this.other = other;         }     }  } ``

Second StellarTest2, in this example, you will see same code, except I am using here angle in degrees:

``float angleInDegrees = MathUtils.atan2(diffY, diffX) * MathUtils.radiansToDegrees; ... acceleration.x = gravityForce * MathUtils.cos(angleInDegrees * deltaTime); acceleration.y = gravityForce * MathUtils.sin(angleInDegrees * deltaTime); ``

In this test, I did not have to add some extra velocity to move smaller object. Also I achieved that smaller object will make a solid curve, but will not get dragger in the center. Instead, after some time it will evict out. However, still I face the issue that smaller object keeps curving in and out and towards center. Yet, I am curious if cos and sin is necessary here, and perhaps StellarTest1 is right approach.

Code StellarTest2:

``public class Stellar2Test extends AbstractTest {      private Stellar stellar1, stellar2;      public Stellar2Test(Game game) {         super(game);     }      @Override     public void create() {         game.getCartesianGrid().setEnabled(true);          float startX = -160;         float startY = -90;         float radius = 10;         float mass = 30;         stellar2 = new Stellar(                 startX, startY,                 radius, mass,                 new Color(102, 188, 217, 100f)         );          startX = 0;         startY = 0;         radius = 30;         mass = 30;         stellar1 = new Stellar(                 startX, startY,                 radius, mass,                 new Color(252, 236, 3, 100f)         );         stellar1.updatable = false;          stellar1.setOther(stellar2);         stellar2.setOther(stellar1);     }      @Override     public void update(float deltaTime) {         if (!updatable) {             return;         }         stellar1.update(deltaTime);         stellar2.update(deltaTime);     }      @Override     public void draw() {         if (!drawable) {             return;         }         stellar1.draw();         stellar2.draw();     }      private class Stellar {          Circle circle;         Vector2 velocity;         Vector2 acceleration;         float mass, radius;         boolean updatable;         Stellar other;          public Stellar(                 float startX, float startY,                 float radius, float mass,                 Color color) {             this.radius = radius;             this.velocity = new Vector2(0, 0);             this.acceleration = new Vector2(0, 0);             this.mass = mass;             this.radius = radius;              circle = new Circle(game,                     color,                     startX, startY,                     radius);              this.updatable = true;         }          public void update(float deltaTime) {             if (!updatable) {                 return;             }             float diffX = other.circle.x - circle.x;             float diffY = other.circle.y - circle.y;             float angleInDegrees = MathUtils.atan2(diffY, diffX) * MathUtils.radiansToDegrees;              float G = 2;             float mass = (G * (other.mass * this.mass));             float distance = (float) Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2));             float gravityForce = mass / distance;              acceleration.x = gravityForce * MathUtils.cos(angleInDegrees * deltaTime);             acceleration.y = gravityForce * MathUtils.sin(angleInDegrees * deltaTime);              velocity.x += acceleration.x * deltaTime;             velocity.y += acceleration.y * deltaTime;              circle.x += velocity.x * deltaTime;             circle.y += velocity.y * deltaTime;         }          public void draw() {             game.getShapeRenderer().begin(ShapeRenderer.ShapeType.Filled);             circle.draw();             game.getShapeRenderer().end();         }          public void setOther(Stellar other) {             this.other = other;         }     }  } ``
Posted on Categories Free Proxy

## Is there any encryption mechanism where i can ensure that the decryption can only happen within my data center?

I have a requirement where i need to store confidential data in an encrypted format in the url, i understand POST with body is better approach but it is not an option for me. I am thinking of using a pass phrase based AES 128 bit encryption for encrypting the query string parameter. The concern i have is that the url could get cached in different parts of the internet and if the pass phrase is exposed somehow then it could be used to decrypt these values.

Posted on Categories proxies

## How to deside what model should be picket for security operation center, design and implimentation?

To pick the right model for design and implement a Security Operation Center, it should pick a most suitable model that is for the business, that could be capable to be tailored.

What are the differences, between Best practices, standards, and frameworks in SOC design?

Posted on Categories proxies

## Longest Even Length Palindromic Substring (with unique adjacent characters except for the center 2 letters)

You are given a string S containing lowercase English characters. You need to find the length of the largest subsequence of S that satisfies the following pattern: X1,X2,X3…Xn,Xn,…X3,X2,X1 where Xi is some character of S. The only constraint is that no adjacent character should be the same except Xn, that is Xi != X(i+1) for all 1<=i< n.

Input: The string: S

Output: The integer: 2n

Constraint: 1<=|S|<=10^3

Sample input 1: “acdbdea”

Sample output 1: 4

Explanation: “adda” is the longest subsequence following the given pattern.

Sample input 2: “abbacdeedc”

Sample output 2: 6

Explanation: “cdeedc” is the longest subsequence following the given pattern.

Sample input 3: “taker”

Sample output 3: 0

Explanation: No subsequence follows the given pattern.

This question was asked in a coding interview and I didn’t know how to solve it. I understood how to find longest palindromic sub sequence but don’t know how to implement the unique adjacent character part. Please help. pseudo code is fine

Posted on Categories proxies

## Call center recording my credit card info

I just made a new contract over the phone with my mobile phone provider and I needed to pay the activation fee. The lady told me that they could accept only credit cards and asked me for the full details (number, expiry date, and security code, the usual stuff) over the phone.

However, she took the details personally (to input them in whatever database they use) and the calls are recorded.

I am now concerned about the security of my information: not only she has full access to my credit card, but also whoever listens to the recording. It’s a big and well-known provider, so I don’t think they could do something shady, but it still bothers me. Is it really acceptable? Should I have refused?

(Note: I live in Switzerland and I don’t know exactly what are the data protection regulations here)