How to resolve the algorithm Find if a point is within a triangle step by step in the FutureBasic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Find if a point is within a triangle step by step in the FutureBasic programming language
Table of Contents
Problem Statement
Find if a point is within a triangle.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Find if a point is within a triangle step by step in the FutureBasic programming language
Source code in the futurebasic programming language
_window = 1
begin enum 1
_textLabel
end enum
void local fn BuildWindow
window _window, @"Find if a point is within a triangle", (0, 0, 340, 360 )
WindowCenter(_window)
WindowSubclassContentView(_window)
ViewSetFlipped( _windowContentViewTag, YES )
ViewSetNeedsDisplay( _windowContentViewTag )
subclass textLabel _textLabel, @"", ( 20, 320, 300, 20 ), _window
end fn
void local fn DrawInView( tag as NSInteger )
BezierPathRef path = fn BezierPathInit
BezierPathMoveToPoint( path, fn CGPointMake( 30, 300 ) )
BezierPathLineToPoint( path, fn CGPointMake( 300, 300 ) )
BezierPathLineToPoint( path, fn CGPointMake( 150, 30 ) )
BezierPathClose( path )
BezierPathStrokeFill( path, 3.0, fn ColorBlack, fn ColorGreen )
AppSetProperty( @"path", path )
end fn
void local fn DoMouse( tag as NSInteger )
CGPoint pt = fn EventLocationInView( tag )
if ( fn BezierPathContainsPoint( fn AppProperty( @"path" ), pt ) )
ControlSetStringValue( _textLabel, fn StringWithFormat( @"Inside triangle: x = %.f y = %.f", pt.x, pt.y ) )
else
ControlSetStringValue( _textLabel, fn StringWithFormat( @"Outside triangle: x = %.f y = %.f", pt.x, pt.y ) )
end if
end fn
void local fn DoDialog( ev as long, tag as long )
select ( ev )
case _viewDrawRect : fn DrawInView(tag)
case _viewMouseDown : fn DoMouse( tag )
case _viewMouseMoved : fn DoMouse( tag )
end select
end fn
fn BuildWindow
on dialog fn DoDialog
HandleEvents
You may also check:How to resolve the algorithm Pangram checker step by step in the jq programming language
You may also check:How to resolve the algorithm ISBN13 check digit step by step in the Delphi programming language
You may also check:How to resolve the algorithm Percentage difference between images step by step in the Julia programming language
You may also check:How to resolve the algorithm Benford's law step by step in the J programming language
You may also check:How to resolve the algorithm Copy stdin to stdout step by step in the ALGOL 68 programming language