Drawing in millimetres in a UIView

I'm trying to draw some UIBezierPath objects in a UIView.
These paths are expressed in millimetres and must be drawn with the correct size.

I'm using the method draw(rect:CGRect) of UIView. In my understanding, drawing functions in a UIView are made in points. So I just need to convert the millimetres in points. But if I'm doing that the paths do not have the correct size. On my 12 pro max, the drawing is always is divided by two.

Here my code, the width of the view is equal to width of the screen

Code Block
// 72 points = 25.4 mm
// So 1 mm  = 72/25.4 pt
func mmToPoints(_ value:CGFloat) -> CGFloat{
    return 72.0 * value/25.4
}
func pointsToMM(_ value:CGFloat) -> CGFloat{
    return value * 25.4/72.0
}
class MyView : UIView{
    override func draw(_ rect: CGRect) {
        let width = rect.width
        let height = rect.height
        print("Rect in pt \(width) \(height)")
        print("Rect in mm \(pointsToMM(width)) \(pointsToMM(height))")      
        let path = UIBezierPath()
        let sizeInMM = CGFloat(50.0); // 50 mm, 5 cm
        let sizeInPts = mmToPoints(sizeInMM)
        UIColor.black.setStroke()
        path.move(to: CGPoint.zero)
        path.addLine(to: CGPoint(x: sizeInPts, y: 0.0))
        path.addLine(to: CGPoint(x: sizeInPts, y: sizeInPts))
        path.addLine(to: CGPoint(x: 0.0, y: sizeInPts))
        path.stroke()
    }
}

I get the following result in the console:
Rect in pt 428.0 845.0
Rect in mm 150.98888888888888 298.09722222222223

We can notice that the width of the rect is twice the screen width of 12 pro max

I don't understand your point:

width of the rect is twice the screen width of 12 pro max

Width is 428.0
What would you expect ?

iPhone 12 pro Max screen is
Resolution 2 778 x 1 284 pixels
Screen resolution (points): 428 x 926

So it is not larger that what you get, and surely not twice the screen width.

get complete figures here
https ://useyourloaf .com/blog/iphone-12-screen-sizes/
The screen width of a 12 pro max is about 73 mm measured with a ruler.
If we convert 428 points into mm we have 150.989 mm which is almost twice the real size.
Normally a point is defined by 25.4 mm / 72 which is about 0.352778 mm which can be easily checked on google
It is like the definition of point is not the same
The screen width of a 12 pro max is about 73 mm measured with a ruler.
If we convert 428 points into mm we have 150.989 mm which is almost twice the real size.
Normally a point is defined by 25.4 mm / 72 which is about 0.352778 mm which can be easily checked on google
It is like the definition of point is not the same
Drawing in millimetres in a UIView
 
 
Q