Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
Chapter 33.1, Problem 3E
Program Plan Intro
To calculate a pseudo code to sort the sequence of n points with respect to their polar angles where a point is given. The procedure must take time equal to
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Let l be a line in the x-yplane. If l is a vertical line, its equation is x = a for some real number a.
Suppose l is not a vertical line and its slope is m. Then the equation of l is y = mx + b, where b is the y-intercept.
If l passes through the point (x₀, y₀), the equation of l can be written as y - y₀ = m(x - x₀).
If (x₁, y₁) and (x₂, y₂) are two points in the x-y plane and x₁ ≠ x₂, the slope of line passing through these points is m = (y₂ - y₁)/(x₂ - x₁).
Instructions
Write a program that prompts the user for two points in the x-y plane. Input should be entered in the following order:
Input x₁
Input y₁
Input x₂
Although the plot function is designed primarily for plotting standard xy graphs, it
can be adapted for other kinds of plotting as well.
b. Make a plot of the curve, which is defined parametrically by the equations
x = 2cosθ + cos2θ, y = 2sinθ - sin2θ,
where 0 < θ < 2π. Take a set of values of θ between zero and 2π and calculate x
and y for each from the equations above, then plot y as a function of x.
b. Taking this approach a step further, one can make a polar plot r = f(θ) for some
function f by calculating r for a range of values of θ and then converting r and
θ to Cartesian coordinates using the standard equations x = r cosθ, y = r sinθ.
Use this method to make a plot of the function
r = ecosθ – 2 cos(4θ) + sin5 (θ/12)
in the range 0 <= θ <= 24π.
use python code to answer the highlight one
Write what each of the following means in computer graphics:
1) Geometrical Transformations which includes,
2D Transformations
Homogenous Coordinates
2D Matrix Transformations
Composition of Transformations
3D Matrix Transformation
Chapter 33 Solutions
Introduction to Algorithms
Ch. 33.1 - Prob. 1ECh. 33.1 - Prob. 2ECh. 33.1 - Prob. 3ECh. 33.1 - Prob. 4ECh. 33.1 - Prob. 5ECh. 33.1 - Prob. 6ECh. 33.1 - Prob. 7ECh. 33.1 - Prob. 8ECh. 33.2 - Prob. 1ECh. 33.2 - Prob. 2E
Ch. 33.2 - Prob. 3ECh. 33.2 - Prob. 4ECh. 33.2 - Prob. 5ECh. 33.2 - Prob. 6ECh. 33.2 - Prob. 7ECh. 33.2 - Prob. 8ECh. 33.2 - Prob. 9ECh. 33.3 - Prob. 1ECh. 33.3 - Prob. 2ECh. 33.3 - Prob. 3ECh. 33.3 - Prob. 4ECh. 33.3 - Prob. 5ECh. 33.3 - Prob. 6ECh. 33.4 - Prob. 1ECh. 33.4 - Prob. 2ECh. 33.4 - Prob. 3ECh. 33.4 - Prob. 4ECh. 33.4 - Prob. 5ECh. 33.4 - Prob. 6ECh. 33 - Prob. 1PCh. 33 - Prob. 2PCh. 33 - Prob. 3PCh. 33 - Prob. 4PCh. 33 - Prob. 5P
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself. Equivalently, a perfect number is a number that is half the sum of all of its positive divisors. The first perfect number is 6, because 1, 2 and 3 are its proper positive divisors, and 1 + 2 + 3 = 6. Equivalently, the number 6 is equal to half the sum of all its positive divisors: (1 + 2 + 3 + 6) / 2 = 6. Write a program to display the of sum all perfect numbers found in the first 1000 integers.arrow_forwardA perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself. Equivalently, a perfect number is a number that is half the sum of all of its positive divisors. The first perfect number is 6, because 1, 2 and 3 are its proper positive divisors, and 1 + 2 + 3 = 6. Equivalently, the number 6 is equal to half the sum of all its positive divisors: (1 + 2 + 3 + 6) / 2 = 6.Write a program to display the of sum all perfect numbers found in the first 1000 integers in javaarrow_forwardThe paper cup shown in the attached document has radius R2=1.5R1, height (h), volume V=716 cm^3,and surface area (S). The height,volume,and surface area of the cup are given by: V= (pi*h(R1^2+R2^2+(R1*R2)))/3 S=pi*R1^2+pi*(R1+R2)*sqrt((R2-R1)^2+h^2) The above equations are shown clearly on the attached document. Determine R1,R2 and S of the paper cups with heights h=8,10,12,14 and 16 using the following Matlab methods: 1. Simulate equations without using a for loop 2.Simulate equations using a for loop The results should be displayed in a table form shown in image. The vectors may be transposed before printing to the screenarrow_forward
- This is a Computer Graphics Question on Projection. Question: Let a 3D point (-5, -6, -423) be projected on a projection plane located at (0, -43, 0). Determine the coordinate of that 3D point on the projection plane using an orthographic parallel projection matrix.arrow_forwardPlease summarize the following paragraph below. You can do it in jot notes. the paragraph below are about how you can use fractal techniques for facial recognition the number number if brackets are for the images below ractal theory of iterated contractive transformation has been used in several areas of image processing and computer vision. In this method, similarity between different parts of an image is used for representing of an image by a set of contractive trans- forms on the space of images, for which the fixed point is close to the original image. This concept was first proposed by Barnsley (9) (11) . Jacquin was the first to publish an implementation of fractal image coding in (11) Despite the number of researchers and the proposed methods, several factors can significantly affect face recognition performances, such as the pose, the presence/absence of structural components, facial expressions, occlusion, and illumination variations. Different image compression methods…arrow_forwarddict1 = {(1,1,1):"red", (2,1,-1):"green", (0,-1,1):"red", (0,0,-2):"blue"}In this case, there are 2 red points, and their centroid is at ( (1+0)/2, (1-1)/2, (1+1)/2 ) = (0.5, 0, 1)Considering that in this example there is only one green and one blue point, they are representing the respective color's centroid. Hence, your function should return the following dictionary:{"red":(0.5,0.0,1.0), "green":(2.0,1.0,-1.0), "blue":(0.0,0.0,-2.0)}arrow_forward
- An airline association assigns three-letter codes to represent airport locations. For example, the airport code for Clark, Pampanga, is CPP. Notice that repetition is allowed in forming this code. How many airport codes are possible?arrow_forwardThis problem is on Computer Graphics and is based on the topic 'Perspective Projection'. Please provide a step-by-step solution to the problem and explain the steps. The solution must include the General purpose perspective projection matrix. Question: Let a 3D point (423, -423, 423) be projected on a projection plane. Given that the center of the projection plane is (0.0, 0.0, -423.0) and the coordinate of the COP is (4, 2, 3). Determine the coordinate of that 3D point on the projection plane using a general purpose perspective projection matrix.arrow_forwardConsider two traffic lights in a junction that each one has a 7-segment display to show the remaining time. The traffic lights are working as follows: State1: Traffic light 1=GREEN Traffic light 2=RED for 10 seconds,State2: Traffic light 1=YELLOW Traffic light 2=YELLOW for 2 seconds,State3: Traffic light 1=RED Traffic light 2=GREEN for 6 seconds,GOTO State1 During each step, the amount of remaining time should be displayed on the 7-segment and it should be updated every one second. For example in State 1, the display shows 9, then after a second it shows 8, and ... finally, it shows 0 for one second, and the control moves to State 2Write an 8051 assembly program according to the Edsim51 configuration, LED 0, LED1 and LED 2 construct the first traffic light, and LED 3, LED 4, and LED 5 can be used for the 2nd traffic light. Assume that the lookup table for 7segment exists on memory at address 0F00harrow_forward
- Q1. Given a 2d grid map of '1's (land) and '0's (water),count the number of islands.An island is surrounded by water and is formed byconnecting adjacent lands horizontally or vertically.You may assume all four edges of the grid are all surrounded by water. Example 1: 11110110101100000000Answer: 1 Example 2: 11000110000010000011Answer: 3""" def num_islands(grid): count = 0 for i in range(len(grid)): for j, col in enumerate(grid[i]): if col == 1: dfs(grid, i, j) count += 1 Please code it.arrow_forwardComputer Science Let C be a black circular disk in front of a white background. The circular disk is parallel to the image plane. This disk is projected on the image plane through a pinhole. What is the shape of the disk’s projection on the image plane? [Hint: A circular disk parallel to the image plane is described algebraically as all 3D points [X,Y,Z]T with (X-X0) 2 +(Y-Y0) 2 =R2 , Z=Z0, where [X0,Y0,Z0] T is the center of the disk and R is its radius.]arrow_forwardGiven two objects represented by the tuples (25, 5, 52, 14) and (10, 0, 36, 8):(a) Compute the Euclidean distance between the two objects.(b) Compute the Manhattan distance between the two objects.(c) Compute the Minkowski distance between the two objects, using q=3arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7); Author: CS Dojo;https://www.youtube.com/watch?v=D6xkbGLQesk;License: Standard YouTube License, CC-BY