Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Consider the polygons that make up the two-dimensional region The author has represented the region using an face-dictionary 'faces = {'fo': ['vo', 'vi', 'v5'),
3. Consider the polygons that make up the two-dimensional region The author has represented the region using an face-dictionary 'faces = {'fo': ['vo', 'vi', 'v5'), 'fl':'vl', 'v3', '14', 'v5'), 'f2': ['vo', 'V2', 'v'] } The keys are the faces and the values are the vertices. So face 0 (a triangle) contains vertices 0, 1 and 5; face 1 (a quadrilateral) contains vertices 1, 3, 4, and 5; face 2 (a triangle) contains vertices 0, 2 and 5. Write a program that, given a face-dictionary, computes the corresponding vertex-dictionary and edge- dictionary, telling you which face a vertex, resp. edge, is contained in. In the above example, these dictionaries would be vertices - {'vo': 'f0', '2'), 'vl': ['0', '1'), 'V2': ['f2'), 'v3':l'fi', ... edges = {['0', '2']: ['f2'], ['v2', 'v5'] : ['f2'], ['vo', 'v5'] : ['2', '0'), ... } } Use dictionary comprehension and iteration over elements wherever possible. I leave it up to you to use lists, tuples or sets to represent collections of elements
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started