Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Prolog program that stores information about geometric objects. You must construct the geometric objects basing on simpler forms. The objects to construct are:

Write a Prolog program that stores information about geometric objects. You must construct the geometric objects basing on simpler forms. The objects to construct are:

2D Point
Segement, can be represented with two 2D points or one 2D point, a slope, and a length
Square
Rectangle
Circle

The program must be able to answer the following questions:

English Prolog

Is this segment parallel to this other line?

parallel(

segment(point2d(x,y), point2d(x,y)), segment (point2d(x,y), point2d(x,y)))

Is this segment perpendicular to this other line?

perpendicular(

segment (point2d(x,y), point2d(x,y)), segment (point2d(x,y), point2d(x,y)))

Is this segment contained in this polygon?

contained(

segment(point2d(x,y), point2d(x,y)), circle(point2d(x,y),r))

Is this polygon contained in this other polygon?

contained( square(point2d(x,y), length), circle(point2d(x,y),r))

Does this polygon intersects this other polygon?

intersects( square(point2d(x,y), length), circle(point2d(x,y),r))

Is this segment vertical?

vertical(segment (point2d(x,y), point2d(x,y)))

Is this segment perpendicular?

perpendicular(segment(point2d(x,y), point2d(x,y)))

Is this point on the figure?

on(point2d(x,y), segment(point2d(x,y), point2d(x,y)))

Is this point in the figure?

in(point2d(x,y), circle(point2d(x,y),r))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions