@@ -35,6 +35,7 @@ PG_FUNCTION_INFO_V1(smoc_not_superset_spoint);
3535PG_FUNCTION_INFO_V1 (smoc_union );
3636PG_FUNCTION_INFO_V1 (smoc_intersection );
3737PG_FUNCTION_INFO_V1 (smoc_degrade );
38+ PG_FUNCTION_INFO_V1 (smoc_spoint );
3839PG_FUNCTION_INFO_V1 (smoc_disc );
3940PG_FUNCTION_INFO_V1 (smoc_scircle );
4041PG_FUNCTION_INFO_V1 (smoc_spoly );
@@ -952,6 +953,33 @@ smoc_degrade(PG_FUNCTION_ARGS)
952953PG_RETURN_POINTER (moc_ret );
953954}
954955
956+ Datum
957+ smoc_spoint (PG_FUNCTION_ARGS )
958+ {
959+ int order = PG_GETARG_INT32 (0 );
960+ SPoint * p = (SPoint * )PG_GETARG_POINTER (1 );
961+ hpint64 pixel ,first ,last ;
962+ void * moc_in_context ;
963+ int32 moc_size ;
964+ Smoc * moc_ret ;
965+
966+ check_order (order );
967+
968+ pixel = healpix_nest_c (order ,p );
969+ first = c_healpix_convert_nest (pixel ,order ,HEALPIX_MAX_ORDER );
970+ last = c_healpix_convert_nest (pixel + 1 ,order ,HEALPIX_MAX_ORDER );
971+
972+ moc_in_context = create_moc_in_context (moc_error_out );
973+ moc_healpix (moc_in_context ,first ,last ,moc_error_out );
974+
975+ moc_size = VARHDRSZ + get_moc_size (moc_in_context ,moc_error_out );
976+ moc_ret = (Smoc * )palloc0 (moc_size );
977+ SET_VARSIZE (moc_ret ,moc_size );
978+
979+ create_moc_release_context (moc_in_context ,moc_ret ,moc_error_out );
980+ PG_RETURN_POINTER (moc_ret );
981+ }
982+
955983Datum
956984smoc_disc (PG_FUNCTION_ARGS )
957985{