Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 AlexDavies · Oct 07, 2019 at 08:30 PM · verticesshapes

Removing internal vertices in a shape

Given a List of Edges (each containing a reference to 2 vertices) I can define a shape. My problem is that a lot of the vertices of the polygon are internal - they lie inside the shape of the polygon - and I need to be able to detect and remove these extra vertices.

Sorry if it's a bit confusing, but a picture's worth a thousand words: Diagram

The red edges and vertices are the ones I would like to delete, and the black edges and green vertices are the ones I would like to keep.

I'm sure there's a bit of maths that makes this easy, but I've no clue how to start :P

TLDR: I need to be able to delete all points that don't form the outline of a polygon.

shadowdiagram.png (7.3 kB)
Comment
Add comment · Show 1
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 TreyH · Oct 07, 2019 at 09:11 PM 0
Share

Is there a Unity-related basis for the question?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Oct 07, 2019 at 10:22 PM

Looks like a duplicate of this one. The main insight is that the inner edges of a mesh are always paired with another one while the outer edges are not. Note that the solution I've posted on the other question assumes that the mesh vertices are fully shared or at least if the aren't shared it's considered an outer edge. For example the default cube in Unity has 6 independent faces. Each face consists of 2 triangles. Those two triangles have one shared edge, the other 4 edges are the outer edges of that face.


Note that since you want to remove the inner vertices, keep in mind that if you actually work with meshes (based on triangles) you would need to re-mesh the outer vertices. Also from your question it's not clear what kind of shapes you might have. Are they always convex? Or can they be concave?

Comment
Add comment · Show 1 · 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 AlexDavies · Oct 08, 2019 at 07:16 PM 0
Share

Sorry for the lack of detail - I should explain the scenario in full. I'm trying to generate a shadow mesh for an object, by casting a ray through all of the object's vertices onto a wall, then connecting the resultant points with the same edges as the original mesh. The example I gave above is a drawing of what is generated for a cube when the 'light' (ray origin) is directly behind it. I need to be able to get the outline of these shadows from only the Edge data, which for each edge is as follows: - A start vertex - An end vertex Ultimately, I'm going to create a flat mesh from this data, but I specifically need the outline for various effects (such as a glowing outline). I don't have any reference to the triangles or faces, only edges. Hence, this causes the problem of figuring out what edges connect to others to form faces, so unfortunately none of the solutions in the other thread are of any use.

Thanks for the help.

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

112 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 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

Accessing a Collider2D's individual shapes 0 Answers

Pivot modifying script 0 Answers

How to calculate the percentage of a mesh visible by a camera? 2 Answers

Changing Y Value in Vertex Array? 1 Answer

How to make sure two meshes have the same vertex count 0 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