Assertion: ellipse's ax | /r/HasProperty | equal
Facets:
value: to each other
type: OTHER
Source sentences:
text: Being an ellipse, a circle inherits these, and also has a radius property, which value is equal to that of the axes (which must, of course, be equal).
text: ;;; ( defmethod initialize-instance (( c circle ) &key radius ) ( setf ( radius c ) radius )) ;; via the setf method below ( defmethod ( setf radius ) :after (( new-value real ) ( c circle )) ( setf ( slot-value c 'h-axis ) new-value ( slot-value c 'v-axis ) new-value )) ;;; ;;; After an assignment is made to the circle's ;;; h-axis or v-axis, a change of type is necessary, ;;; unless the new value is the same as the radius. ;;; ( defmethod ( setf h-axis ) :after (( new-value real ) ( c circle )) ( unless ( = ( radius c ) new-value ) ( change-class c 'ellipse ))) ( defmethod ( setf v-axis ) :after (( new-value real ) ( c circle )) ( unless ( = ( radius c ) new-value ) ( change-class c 'ellipse ))) ;;; ;;; Ellipse changes to a circle if accessors ;;; mutate it such that the axes are equal, ;;; or if an attempt is made to construct it that way. ;;; ;;; EQL equality is used, under which 0 /= 0.0. ;;; ;;; The SUBTYPEP checks are needed because these methods ;;; apply to circles too, which are ellipses!!! ;;; ( defmethod initialize-instance :after (( e ellipse ) &key h-axis v-axis ) ( if ( = h-axis v-axis ) ( change-class e 'circle ))) ( defmethod ( setf h-axis ) :after (( new-value real ) ( e ellipse )) ( unless ( subtypep ( class-of e ) 'circle ) ( if ( = ( h-axis e ) ( v-axis e )) ( change-class e 'circle )))) ( defmethod ( setf v-axis ) :after (( new-value real ) ( e ellipse )) ( unless ( subtypep ( class-of e ) 'circle ) ( if ( = ( h-axis e ) ( v-axis e )) ( change-class e 'circle )))) ;;; ;;; Method for an ellipse becoming a circle.
text: If we substitute for zero eccentricity in the equations above, we obtain a = b, so both axes are equal to each other, and to the circle’s radius.