SlideShare a Scribd company logo
1 of 1
Download to read offline
IN PYTHON:
11.34 final project 1 : ellipses ... For this lab you will build a class that implements ellipses. We
define the distance between point (x,y) to the ellipse centered at point ( xc,yc) with x-axis length (a
) and y-axis length (b) as d2=a2(xxc)2+b2(yyc)2 Note that this is an axis aligned ellipse. The
ellipse also has a parameter theta that sets its rotation angle. Note that theta is a rotation around
the point (xc,yc) and not around the origin. Write a class called ellipse_2d that takes at
construction the values center =(xc,yc),ab=(a,b), theta. Use as default values center =(0,0),ab=(1,
1), theta =0. Your ellipse_2d class should implement the following: 1. A method called d(x,y) that
returns the distance from the ellipse to point (x,y). 2. A method called intPts ( d) that returns a list
of (x,y) pairs at all integer (x,y) locations within distance d of the ellipse. Note: an integer location
is e.g. (3,1) is an (x,y) pair that have no fractional component. 3. A property called theta that sets a
rotation angle on the ellipse. IMPORTANT: the rotation must be centered on the point (xc, yc)
NOT around the origin. HINTS 1. To rotate a point (x,y) around the origin by an angle theta, use
import numpy as np mxRotate =nparray([[npcos( theta ),1npsin( theta )],[npsin(theta),npcos(theta
)]]) (xRot,yRot)=npmatmul((x,y),mxRotate) 2. Before rotating a point, be sure to 'center' it on the
ellipse, x=xxcy=yyc This is because we want the ellipse to rotate about its own centroid, not about
the origin. After rotating, be sure to reverse the centering. 3. You may find it helpful to plot your
ellipse, use plt.plot(x,y,,r) to draw a red dot at every point (x,y). Also, adding a plt. gca () . axis
('equal') will show your plot with the proper aspect ratio between the X and Y axes spacing.

More Related Content

Similar to Python Ellipse Class

Journey to structure from motion
Journey to structure from motionJourney to structure from motion
Journey to structure from motionJa-Keoung Koo
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerJanie Clayton
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developingAbbyWhyte974
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developingMartineMccracken314
 
DETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECTDETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECTAM Publications
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 
Module 2 lesson 4 notes
Module 2 lesson 4 notesModule 2 lesson 4 notes
Module 2 lesson 4 notestoni dimella
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformationsshanthishyam
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingFayan TAO
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
Numerical Analysis Assignment Help
Numerical Analysis Assignment HelpNumerical Analysis Assignment Help
Numerical Analysis Assignment HelpMath Homework Solver
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2SIMONTHOMAS S
 

Similar to Python Ellipse Class (20)

Journey to structure from motion
Journey to structure from motionJourney to structure from motion
Journey to structure from motion
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing
 
1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing1) IntroductionThis practical work consists of developing
1) IntroductionThis practical work consists of developing
 
DETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECTDETECTION OF MOVING OBJECT
DETECTION OF MOVING OBJECT
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Module 2 lesson 4 notes
Module 2 lesson 4 notesModule 2 lesson 4 notes
Module 2 lesson 4 notes
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformations
 
SSA slides
SSA slidesSSA slides
SSA slides
 
2d transformation
2d transformation2d transformation
2d transformation
 
Statistical Physics Assignment Help
Statistical Physics Assignment HelpStatistical Physics Assignment Help
Statistical Physics Assignment Help
 
06.Transformation.ppt
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume rendering
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
Parabola
ParabolaParabola
Parabola
 
Lecture_note2.pdf
Lecture_note2.pdfLecture_note2.pdf
Lecture_note2.pdf
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
Numerical Analysis Assignment Help
Numerical Analysis Assignment HelpNumerical Analysis Assignment Help
Numerical Analysis Assignment Help
 
Numerical Analysis Assignment Help
Numerical Analysis Assignment HelpNumerical Analysis Assignment Help
Numerical Analysis Assignment Help
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2
 

More from adithiyaatextile

In the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdfIn the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdfadithiyaatextile
 
In terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdfIn terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdfadithiyaatextile
 
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdfIn the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdfadithiyaatextile
 
In the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdfIn the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdfadithiyaatextile
 
In the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdfIn the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdfadithiyaatextile
 
In the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdfIn the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdfadithiyaatextile
 
In the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdfIn the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdfadithiyaatextile
 
In the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdfIn the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdfadithiyaatextile
 
In the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdfIn the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdfadithiyaatextile
 
In the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdfIn the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdfadithiyaatextile
 
In the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdfIn the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdfadithiyaatextile
 
In the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdfIn the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdfadithiyaatextile
 
In the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdfIn the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdfadithiyaatextile
 
In the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdfIn the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdfadithiyaatextile
 
In the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdfIn the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdfadithiyaatextile
 
In the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdfIn the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdfadithiyaatextile
 
In the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdfIn the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdfadithiyaatextile
 
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdfIn the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdfadithiyaatextile
 
In Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdfIn Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdfadithiyaatextile
 
In the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdfIn the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdfadithiyaatextile
 

More from adithiyaatextile (20)

In the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdfIn the pedigree below persons with a hatched marking are af.pdf
In the pedigree below persons with a hatched marking are af.pdf
 
In terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdfIn terms of race and ethnicity a People who are White in ra.pdf
In terms of race and ethnicity a People who are White in ra.pdf
 
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdfIn the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
In the NPR Hidden Brain Podcast we listened to Professor Ban.pdf
 
In the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdfIn the following exercise we use data from HollywoodMovies.pdf
In the following exercise we use data from HollywoodMovies.pdf
 
In the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdfIn the movie Austin Powers International Man of Mystery a.pdf
In the movie Austin Powers International Man of Mystery a.pdf
 
In the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdfIn the past Ethernets predominantly used a medium access co.pdf
In the past Ethernets predominantly used a medium access co.pdf
 
In the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdfIn the initial Cournot oligopoly equilibrium both firms hav.pdf
In the initial Cournot oligopoly equilibrium both firms hav.pdf
 
In the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdfIn the fruit fly Drosophila a spineless no wing bristles.pdf
In the fruit fly Drosophila a spineless no wing bristles.pdf
 
In the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdfIn the implementation of the ordinary Queue if the dequeue .pdf
In the implementation of the ordinary Queue if the dequeue .pdf
 
In the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdfIn the formula IPAT which of the following would be repres.pdf
In the formula IPAT which of the following would be repres.pdf
 
In the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdfIn the game Sorry players draw a card and move around the.pdf
In the game Sorry players draw a card and move around the.pdf
 
In the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdfIn the following web login system Assuming that the applica.pdf
In the following web login system Assuming that the applica.pdf
 
In the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdfIn the following table provide a short explanation of how ea.pdf
In the following table provide a short explanation of how ea.pdf
 
In the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdfIn the field of anthropology primatology and genetics ther.pdf
In the field of anthropology primatology and genetics ther.pdf
 
In the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdfIn the film The Ghosts of Stonehenge it is suggested that.pdf
In the film The Ghosts of Stonehenge it is suggested that.pdf
 
In the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdfIn the fall of 2021 the United States enacted a 12 trilli.pdf
In the fall of 2021 the United States enacted a 12 trilli.pdf
 
In the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdfIn the early 2000s manatee numbers in Florida were hoverin.pdf
In the early 2000s manatee numbers in Florida were hoverin.pdf
 
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdfIn the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
In the 1960s the Supreme Court of Chief Justice Earl Warren.pdf
 
In Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdfIn Python I am struggling with getting the functions to wor.pdf
In Python I am struggling with getting the functions to wor.pdf
 
In the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdfIn the Bully leader election algorithm if a process receive.pdf
In the Bully leader election algorithm if a process receive.pdf
 

Recently uploaded

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 

Python Ellipse Class

  • 1. IN PYTHON: 11.34 final project 1 : ellipses ... For this lab you will build a class that implements ellipses. We define the distance between point (x,y) to the ellipse centered at point ( xc,yc) with x-axis length (a ) and y-axis length (b) as d2=a2(xxc)2+b2(yyc)2 Note that this is an axis aligned ellipse. The ellipse also has a parameter theta that sets its rotation angle. Note that theta is a rotation around the point (xc,yc) and not around the origin. Write a class called ellipse_2d that takes at construction the values center =(xc,yc),ab=(a,b), theta. Use as default values center =(0,0),ab=(1, 1), theta =0. Your ellipse_2d class should implement the following: 1. A method called d(x,y) that returns the distance from the ellipse to point (x,y). 2. A method called intPts ( d) that returns a list of (x,y) pairs at all integer (x,y) locations within distance d of the ellipse. Note: an integer location is e.g. (3,1) is an (x,y) pair that have no fractional component. 3. A property called theta that sets a rotation angle on the ellipse. IMPORTANT: the rotation must be centered on the point (xc, yc) NOT around the origin. HINTS 1. To rotate a point (x,y) around the origin by an angle theta, use import numpy as np mxRotate =nparray([[npcos( theta ),1npsin( theta )],[npsin(theta),npcos(theta )]]) (xRot,yRot)=npmatmul((x,y),mxRotate) 2. Before rotating a point, be sure to 'center' it on the ellipse, x=xxcy=yyc This is because we want the ellipse to rotate about its own centroid, not about the origin. After rotating, be sure to reverse the centering. 3. You may find it helpful to plot your ellipse, use plt.plot(x,y,,r) to draw a red dot at every point (x,y). Also, adding a plt. gca () . axis ('equal') will show your plot with the proper aspect ratio between the X and Y axes spacing.