Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97135344
inside.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 2, 20:04
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Jan 4, 20:04 (2 d)
Engine
blob
Format
Raw Data
Handle
23333517
Attached To
R1448 Lenstool-HPC
inside.c
View Options
#include<stdio.h>
#include<math.h>
#include<fonction.h>
#include<constant.h>
#include<dimension.h>
#include<structure.h>
/****************************************************************/
/* nom: inside */
/* auteur: Jean-Paul Kneib */
/* date: 10/02/92 */
/* place: Toulouse */
/****************************************************************
* Return 1 if P is inside the triangle T, 0 otherwise.
* Parameters :
* - P : a point
* - T : a triplet of points.
*/
int
inside
(
struct
point
*
P
,
struct
triplet
*
T
)
{
double
s
,
s1
,
s2
,
d
;
d
=
determinant
(
&
T
->
a
,
&
T
->
b
,
&
T
->
c
);
s
=
determinant
(
&
T
->
a
,
&
T
->
b
,
P
)
*
d
;
s1
=
determinant
(
&
T
->
b
,
&
T
->
c
,
P
)
*
d
;
s2
=
determinant
(
&
T
->
c
,
&
T
->
a
,
P
)
*
d
;
return
((
s
>
0.
)
&&
(
s1
>
0.
)
&&
(
s2
>
0.
));
}
/****************************************************************
* Return 1 if P is inside the triangle T or on its border, 0 otherwise.
* Parameters :
* - P : a point
* - T : a triplet of points.
*/
int
insidebord
(
struct
point
*
P
,
struct
triplet
*
T
)
{
double
s
,
s1
,
s2
,
d
;
d
=
determinant
(
&
T
->
a
,
&
T
->
b
,
&
T
->
c
);
s
=
determinant
(
&
T
->
a
,
&
T
->
b
,
P
)
*
d
;
s1
=
determinant
(
&
T
->
b
,
&
T
->
c
,
P
)
*
d
;
s2
=
determinant
(
&
T
->
c
,
&
T
->
a
,
P
)
*
d
;
return
((
s
>=
0.
)
&&
(
s1
>=
0.
)
&&
(
s2
>=
0.
));
}
Event Timeline
Log In to Comment