Skip to content

cpml.intersect.segment_segment fails to find intersects for some segments #90

@kromka-chleba

Description

@kromka-chleba

I'm using CPML's cpml.intersect.segment_segment for finding road intersections in my Minetest mod and I noticed that CPML fails to find intersections for some of them. I compared CPML output with mlib's mlib.segment.getIntersection for the data and mlib finds them correctly.

Data for which CPML fails but mlib works:

Case 1

Seg1: {
	{
		y = -32,
		z = 97,
		x = 448
	},
	{
		y = -32,
		z = 13,
		x = 532
	}
}
Seg2: {
	{
		y = -32,
		z = -12,
		x = 524
	},
	{
		y = -32,
		z = 208,
		x = 524
	}
}
mlib: {
	y = -32,
	z = 21,
	x = 524
}
CPML: nil

Case 2

Seg1: {
	{
		y = -32,
		z = 290,
		x = 688
	},
	{
		y = -32,
		z = 353,
		x = 625
	}
}
Seg2: {
	{
		y = -32,
		z = 208,
		x = 524
	},
	{
		y = -32,
		z = 331,
		x = 647
	}
}
mlib: {
	y = -32,
	z = 331,
	x = 647
}
CPML: nil

Case 3

Seg1: {
	{
		y = -32,
		z = 290,
		x = 688
	},
	{
		y = -32,
		z = 353,
		x = 625
	}
}
Seg2: {
	{
		y = -32,
		z = 331,
		x = 647
	},
	{
		y = -32,
		z = 448,
		x = 647
	}
}
mlib: {
	y = -32,
	z = 331,
	x = 647
}
CPML: nil

Case 4

Seg1: {
	{
		y = -32,
		z = 928,
		x = 489
	},
	{
		y = -32,
		z = 805,
		x = 612
	}
}
Seg2: {
	{
		y = -32,
		z = 810,
		x = 621
	},
	{
		y = -32,
		z = 810,
		x = 448
	}
}
mlib: {
	y = -32,
	z = 810,
	x = 607
}
CPML: nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions