How to specify that points must satisfy arbitrary equation in SubDomain Class?

Hello, I am trying to solve the Poisson equation for a problem with multiple subdomains and multiple materials, I was able to do this succesfully in 2D using Constructive Solid Geometry and the domain.set_subdomain() method, but this approach is not implemented in 3D. I was browsing the documentation for FEniCS and DOLFIN and I found the example 23 “Poisson equation with multiple subdomains” in the link:

https://fenicsproject.org/docs/dolfin/1.4.0/python/demo/documented/subdomains-poisson/python/documentation.html

In this example subdomains are created by definning a class that inherits from the SubDomain class

class MySubdomain(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.0) 

I would like to know if it is correct to define a geometrical region with CSG functions, for example

myRegion = Cylinder(df.Point(11.0, 13.0, 0.0), df.Point(11.0, 13.0, 150.0), r1, r2, h)

and then pass this CSG object to the class MySubomain, like I do in the following:

myRegion = Cylinder(df.Point(11.0, 13.0, 0.0), df.Point(11.0, 13.0, 150.0), r1, r2, h)

class myDomain(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], myRegion) and near(x[1], myRegion) and near(x[2], myRegion)