• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by WytchWare · Nov 18, 2017 at 01:57 AM · mathvector

Given a point, a "radius" and an arc, how do I find the resulting point?

Like this diagram here

diagram

What is the value of X and Y? Even if someone just knows generally mathematically how to do it.

mathquestion.png (7.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Eno-Khaon · Nov 18, 2017 at 11:47 AM

When you already know the center point for the rotation as well as the angle, this is a simple and straightforward transformation to apply.

Fundamentally, the calculations are based on a 2-Dimensional, 2x2 rotation matrix.

 // Where "T" is the rotation value theta, or θ
 ┌                 ┐
 |cos(T)    -sin(T)|
 |sin(T)    cos(T) |
 └                 ┘


When you apply this to a given value, it will look something like this:

 // C#
 public static Vector2 RotatePoint(Vector2 inputPoint, Vector2 center, float degrees)
 {
     // First, convert degrees to radians
     float radians = degrees * Mathf.Deg2Rad;
     
     // Then, create the output
     Vector2 outputPoint = inputPoint;
     
     // Next, shift the input based on the center of rotation
     Vector2 shiftedPoint = inputPoint - center;
     
     // Finally, apply the values from the matrix to the X and Y
     outputPoint.x = center.x + (shiftedPoint.x * Mathf.Cos(radians) - shiftedPoint.y * Mathf.Sin(radians));
     outputPoint.y = center.y + (shiftedPoint.y * Mathf.Cos(radians) + shiftedPoint.x * Mathf.Sin(radians));
     
     return outputPoint;
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

78 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Find Line intersections 1 Answer

Math/Vector Math finding weighted coordinates 2 Answers

How to get a vector3 (postion) 1 unit away from another in the direction of a 3rd vector3? 2 Answers

Math behind Transform.TransformPoint? 1 Answer

Moveing on a Sphere in direction of Camera with Math 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges