Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Endesmomo · Nov 08, 2012 at 08:22 PM · areapolygonintersection

Getting the area of the intersection of two polygons.

This is two questions in one. 1) Does Unity have something to calculate the intersection of two polygons? 2) Does Unity have a way of calculating the area of a polygon?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by sparkzbarca · Nov 10, 2012 at 09:06 AM

A Does unity have someway to detect where 2 shapes collide? thats call collision detection.

the formula for the area of a polygon is well known

http://www.mathopenref.com/polygonregulararea.html

squareing and tangent and all the hard math stuff does indeed have functions in mathf

like mathf.tan

You just write the formula found on the website using the mathf functions for things like the square of a number and the tangent.

Comment
Add comment · Show 4 · 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
avatar image Endesmomo · Nov 10, 2012 at 08:29 PM 0
Share

Thanks, but with collision detection you can know whether two objects collided. What I want is to get the polygon that represents the intersection of two polygons.

avatar image Endesmomo · Nov 10, 2012 at 08:31 PM 0
Share

The link you provide gives the formula to calculate regular polygons. I don't mean regular polygons, just polygons, that is, irregular polygons. It's pretty trivial too, you just get the list of triangles of the mesh and calculate each triangles area but I wanted to know if Unity does already have a function for that.

avatar image sparkzbarca · Nov 10, 2012 at 08:40 PM 0
Share

sorry im confused, if 2 squares intersect how does that make another square or shape.

Or are you like saying basically you want to kind of place one shape over another and get only the area they share and not the areas they dont.

A kind of venn diagram of that takes the 2 circles or whatever and returns only the overlap?

avatar image Endesmomo · Nov 10, 2012 at 09:27 PM 0
Share

Exactly, that's intersection in geometry. Suppose you have translucent foil paper, one sheet of color yellow and one sheet of color blue. You place them overlapping. The area that you'll see in color green, is the intersection of both sheets, I.$$anonymous$$ polygons.

avatar image
1

Answer by Loius · Nov 10, 2012 at 09:43 PM

As far as I'm aware, Unity doesn't know what a polygon is - it only keeps track of individual triangles.

You could teach it about polygons and intersection, like you mentioned, but it's not a default option.

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.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

Intersection area of two objects? 0 Answers

Problem with getting colliding objects 3 Answers

low impact alternitve to onTriggerEnter 1 Answer

Intersection of two lines 0 Answers

Finding the polygon/face your'e currently looking at? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges